Skip to content

Commit 8b4f151

Browse files
author
Michael Lehenbauer
committed
Add more logging to abort.
1 parent dbd57b1 commit 8b4f151

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/firestore/src/local/simple_db.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import { assert } from '../util/assert';
1919
import { Code, FirestoreError } from '../util/error';
2020
import { debug } from '../util/log';
21+
import * as log from '../util/log';
2122
import { Deferred } from '../util/promise';
2223
import { SCHEMA_VERSION } from './indexeddb_schema';
2324
import { PersistencePromise } from './persistence_promise';
@@ -192,6 +193,7 @@ export class SimpleDb {
192193
const transactionFnResult = transactionFn(transaction)
193194
.catch(error => {
194195
// Abort the transaction if there was an error.
196+
log.error('TransactionFn failed, aborting transaction.', error);
195197
transaction.abort(error);
196198
// We cannot actually recover, and calling `abort()` will cause the transaction's
197199
// completion promise to be rejected. This in turn means that we won't use
@@ -312,7 +314,8 @@ export class SimpleDbTransaction {
312314
this.transaction.oncomplete = () => {
313315
this.completionDeferred.resolve();
314316
};
315-
this.transaction.onabort = () => {
317+
this.transaction.onabort = (event) => {
318+
log.error('transaction onabort called', transaction.error);
316319
if (transaction.error) {
317320
this.completionDeferred.reject(transaction.error);
318321
} else {
@@ -329,6 +332,7 @@ export class SimpleDbTransaction {
329332
}
330333

331334
abort(error?: Error): void {
335+
log.error('SimpleDbTransaction.abort() called.', error);
332336
if (error) {
333337
this.completionDeferred.reject(error);
334338
}

0 commit comments

Comments
 (0)