don't swallow anything that isn't a request error
This commit is contained in:
parent
704d7b32da
commit
a19d93dbef
1 changed files with 4 additions and 2 deletions
|
@ -169,7 +169,7 @@ export class Store<T> extends QueryTarget<T> {
|
||||||
const request = this._idbStore.add(value);
|
const request = this._idbStore.add(value);
|
||||||
this._prepareErrorLog(request, log, "add", undefined, value);
|
this._prepareErrorLog(request, log, "add", undefined, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async tryAdd(value: T, log: LogItem): Promise<boolean> {
|
async tryAdd(value: T, log: LogItem): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
await reqAsPromise(this._idbStore.add(value));
|
await reqAsPromise(this._idbStore.add(value));
|
||||||
|
@ -178,8 +178,10 @@ export class Store<T> extends QueryTarget<T> {
|
||||||
if (err instanceof IDBRequestError) {
|
if (err instanceof IDBRequestError) {
|
||||||
log.log({l: "could not write", id: this._getKey(value), e: err}, log.level.Warn);
|
log.log({l: "could not write", id: this._getKey(value), e: err}, log.level.Warn);
|
||||||
err.preventTransactionAbort();
|
err.preventTransactionAbort();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue