Skip to content

Commit 9f23274

Browse files
committed
putting errors in the errors.ts
1 parent 1dfa391 commit 9f23274

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const ERR_BEST_EFFORT_REQUIRED_READ_ONLY = new Error('Best effort only works for read-only queries');
2+
export const READ_ONLY_TXN = new Error('Txn is read-only');

src/txn.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { QueryTxn, MutateTxn, Mutation, Response } from '../native';
2+
import { READ_ONLY_TXN } from './errors';
23

34
export type TxnOptions = {
45
readOnly?: boolean;
@@ -52,7 +53,7 @@ export class Txn {
5253
});
5354
});
5455
} else {
55-
return Promise.reject(new Error('txn is read-only'));
56+
return Promise.reject(READ_ONLY_TXN);
5657
}
5758
}
5859

@@ -70,7 +71,7 @@ export class Txn {
7071
});
7172
});
7273
} else {
73-
return Promise.reject(new Error('txn is read-only'));
74+
return Promise.reject(READ_ONLY_TXN);
7475
}
7576
}
7677

@@ -88,7 +89,7 @@ export class Txn {
8889
});
8990
});
9091
} else {
91-
return Promise.reject(new Error('txn is read-only'));
92+
return Promise.reject(READ_ONLY_TXN);
9293
}
9394
}
9495

0 commit comments

Comments
 (0)