You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-01 04:43:29 +03:00
Doc exception handling fun
This commit is contained in:
@@ -359,7 +359,14 @@ function createDatabase(db) {
|
|||||||
outgoingRoomKeyRequestsStore.createIndex("state", "state");
|
outgoingRoomKeyRequestsStore.createIndex("state", "state");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Aborts a transaction with a given exception
|
||||||
|
* The transaction promise will be rejected with this exception.
|
||||||
|
*/
|
||||||
function abortWithException(txn, e) {
|
function abortWithException(txn, e) {
|
||||||
|
// We cheekily stick our exception onto the transaction object here
|
||||||
|
// We could alternatively make the thing we pass back to the app
|
||||||
|
// an object containing the transaction and exception.
|
||||||
txn._mx_abortexception = e;
|
txn._mx_abortexception = e;
|
||||||
txn.abort();
|
txn.abort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,7 +302,11 @@ export default class IndexedDBCryptoStore {
|
|||||||
* transaction object: an opaque object that should be passed
|
* transaction object: an opaque object that should be passed
|
||||||
* to store functions.
|
* to store functions.
|
||||||
* @return {Promise} Promise that resolves with the result of the `func`
|
* @return {Promise} Promise that resolves with the result of the `func`
|
||||||
* when the transaction is complete
|
* when the transaction is complete. If the backend is
|
||||||
|
* async (ie. the indexeddb backend) any of the callback
|
||||||
|
* functions throwing an exception will cause this promise to
|
||||||
|
* reject with that exception. On synchronous backends, the
|
||||||
|
* exception will propagate to the caller of the getFoo method.
|
||||||
*/
|
*/
|
||||||
doTxn(mode, stores, func) {
|
doTxn(mode, stores, func) {
|
||||||
return this._connect().then((backend) => {
|
return this._connect().then((backend) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user