Skip to content

Commit

Permalink
putting errors in the errors.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
lhr0909 committed May 13, 2020
1 parent 1dfa391 commit 9f23274
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const ERR_BEST_EFFORT_REQUIRED_READ_ONLY = new Error('Best effort only works for read-only queries');
export const READ_ONLY_TXN = new Error('Txn is read-only');
7 changes: 4 additions & 3 deletions src/txn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { QueryTxn, MutateTxn, Mutation, Response } from '../native';
import { READ_ONLY_TXN } from './errors';

export type TxnOptions = {
readOnly?: boolean;
Expand Down Expand Up @@ -52,7 +53,7 @@ export class Txn {
});
});
} else {
return Promise.reject(new Error('txn is read-only'));
return Promise.reject(READ_ONLY_TXN);
}
}

Expand All @@ -70,7 +71,7 @@ export class Txn {
});
});
} else {
return Promise.reject(new Error('txn is read-only'));
return Promise.reject(READ_ONLY_TXN);
}
}

Expand All @@ -88,7 +89,7 @@ export class Txn {
});
});
} else {
return Promise.reject(new Error('txn is read-only'));
return Promise.reject(READ_ONLY_TXN);
}
}

Expand Down

0 comments on commit 9f23274

Please sign in to comment.