summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/dictionary-import-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-01-15 06:12:33 -0500
committerGitHub <noreply@github.com>2024-01-15 11:12:33 +0000
commit48f1d012ad5045319d4e492dfbefa39da92817b2 (patch)
tree51b5b53a7b1192f04a8292c3a9aa0f5063c64b46 /ext/js/pages/settings/dictionary-import-controller.js
parent9cfa20cbd2289d82a5abf05a2e5ea8af5016222c (diff)
Add toError utility function (#523)
* Add asError utility function * Rename to toError
Diffstat (limited to 'ext/js/pages/settings/dictionary-import-controller.js')
-rw-r--r--ext/js/pages/settings/dictionary-import-controller.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js
index eadfcb91..0c2fa7a5 100644
--- a/ext/js/pages/settings/dictionary-import-controller.js
+++ b/ext/js/pages/settings/dictionary-import-controller.js
@@ -18,6 +18,7 @@
import {log} from '../../core.js';
import {ExtensionError} from '../../core/extension-error.js';
+import {toError} from '../../core/to-error.js';
import {DictionaryWorker} from '../../dictionary/dictionary-worker.js';
import {querySelectorNotNull} from '../../dom/query-selector.js';
import {yomitan} from '../../yomitan.js';
@@ -126,7 +127,7 @@ export class DictionaryImportController {
this._showErrors(errors);
}
} catch (error) {
- this._showErrors([error instanceof Error ? error : new Error(`${error}`)]);
+ this._showErrors([toError(error)]);
} finally {
prevention.end();
this._setModifying(false);
@@ -200,7 +201,7 @@ export class DictionaryImportController {
await this._importDictionary(files[i], importDetails, onProgress);
}
} catch (err) {
- this._showErrors([err instanceof Error ? err : new Error(`${err}`)]);
+ this._showErrors([toError(err)]);
} finally {
prevention.end();
for (const progress of progressContainers) { progress.hidden = true; }