From 48f1d012ad5045319d4e492dfbefa39da92817b2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 15 Jan 2024 06:12:33 -0500 Subject: Add toError utility function (#523) * Add asError utility function * Rename to toError --- ext/js/pages/settings/backup-controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/js/pages/settings/backup-controller.js') diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js index 2ae52925..457acc18 100644 --- a/ext/js/pages/settings/backup-controller.js +++ b/ext/js/pages/settings/backup-controller.js @@ -19,6 +19,7 @@ import {Dexie} from '../../../lib/dexie.js'; import {isObject, log} from '../../core.js'; import {parseJson} from '../../core/json.js'; +import {toError} from '../../core/to-error.js'; import {OptionsUtil} from '../../data/options-util.js'; import {ArrayBufferUtil} from '../../data/sandbox/array-buffer-util.js'; import {querySelectorNotNull} from '../../dom/query-selector.js'; @@ -498,7 +499,7 @@ export class BackupController { try { await this._importSettingsFile(file); } catch (error) { - this._showSettingsImportError(error instanceof Error ? error : new Error(`${error}`)); + this._showSettingsImportError(toError(error)); } } -- cgit v1.2.3