forked from mystiq/hydrogen-web
Switch errors to using nulls
This commit is contained in:
parent
50b7a8a3fd
commit
0b8acb51a4
2 changed files with 4 additions and 4 deletions
|
@ -42,9 +42,9 @@ export const STORE_MAP: Readonly<{ [name : string]: string }> = Object.freeze(ST
|
|||
|
||||
export class StorageError extends Error {
|
||||
errcode?: string;
|
||||
cause?: Error;
|
||||
cause: Error | null;
|
||||
|
||||
constructor(message: string, cause?: Error) {
|
||||
constructor(message: string, cause: Error | null = null) {
|
||||
super(message);
|
||||
if (cause) {
|
||||
this.errcode = cause.name;
|
||||
|
|
|
@ -21,7 +21,7 @@ export class IDBError extends StorageError {
|
|||
storeName: string;
|
||||
databaseName: string;
|
||||
|
||||
constructor(message: string, source, cause: DOMException | null) {
|
||||
constructor(message: string, source, cause: DOMException | null = null) {
|
||||
const storeName = source?.name || "<unknown store>";
|
||||
const databaseName = source?.transaction?.db?.name || "<unknown db>";
|
||||
let fullMessage = `${message} on ${databaseName}.${storeName}`;
|
||||
|
@ -37,7 +37,7 @@ export class IDBError extends StorageError {
|
|||
if (cause) {
|
||||
fullMessage += cause.message;
|
||||
}
|
||||
super(fullMessage, cause || undefined);
|
||||
super(fullMessage, cause);
|
||||
this.storeName = storeName;
|
||||
this.databaseName = databaseName;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue