diff options
Diffstat (limited to 'ext/js/pages/settings/anki-controller.js')
-rw-r--r-- | ext/js/pages/settings/anki-controller.js | 7 |
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); |