mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
Switch errors to using nulls
This commit is contained in:
parent
50b7a8a3fd
commit
0b8acb51a4
@ -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 New Issue
Block a user