Closed birtles closed 4 years ago
Currently for both error and abort events, transactions run the same event handler (see this code):
error
abort
const error = () => { reject(tx.error); unlisten(); }; // ... tx.addEventListener('error', error); tx.addEventListener('abort', error);
However, when a transaction is aborted, tx.error may be null as per the spec.
tx.error
null
Having await tx.done throw null is a bit confusing. Perhaps we should have a separate event handler for abort that rejects with an AbortError if tx.error === null?
await tx.done
AbortError
tx.error === null
Agreed. AbortError is the right thing here.
Currently for both
error
andabort
events, transactions run the same event handler (see this code):However, when a transaction is aborted,
tx.error
may benull
as per the spec.Having
await tx.done
thrownull
is a bit confusing. Perhaps we should have a separate event handler forabort
that rejects with anAbortError
iftx.error === null
?