aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/anki-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/anki-controller.js
parent9cfa20cbd2289d82a5abf05a2e5ea8af5016222c (diff)
Add toError utility function (#523)
* Add asError utility function * Rename to toError
Diffstat (limited to 'ext/js/pages/settings/anki-controller.js')
-rw-r--r--ext/js/pages/settings/anki-controller.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js
index d64034a5..c8daa85b 100644
--- a/ext/js/pages/settings/anki-controller.js
+++ b/ext/js/pages/settings/anki-controller.js
@@ -19,6 +19,7 @@
import {AnkiConnect} from '../../comm/anki-connect.js';
import {EventListenerCollection, log} from '../../core.js';
import {ExtensionError} from '../../core/extension-error.js';
+import {toError} from '../../core/to-error.js';
import {AnkiUtil} from '../../data/anki-util.js';
import {querySelectorNotNull} from '../../dom/query-selector.js';
import {SelectorObserver} from '../../dom/selector-observer.js';
@@ -409,7 +410,7 @@ export class AnkiController {
this._sortStringArray(result);
return [result, null];
} catch (e) {
- return [[], e instanceof Error ? e : new Error(`${e}`)];
+ return [[], toError(e)];
}
}
@@ -422,7 +423,7 @@ export class AnkiController {
this._sortStringArray(result);
return [result, null];
} catch (e) {
- return [[], e instanceof Error ? e : new Error(`${e}`)];
+ return [[], toError(e)];
}
}
@@ -487,7 +488,7 @@ export class AnkiController {
try {
await this._testAnkiNoteViewer(mode);
} catch (e) {
- this._setAnkiNoteViewerStatus(true, e instanceof Error ? e : new Error(`${e}`));
+ this._setAnkiNoteViewerStatus(true, toError(e));
return;
}
this._setAnkiNoteViewerStatus(true, null);