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/comm/mecab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/js/comm') diff --git a/ext/js/comm/mecab.js b/ext/js/comm/mecab.js index 6d0f3f40..f3ad7b51 100644 --- a/ext/js/comm/mecab.js +++ b/ext/js/comm/mecab.js @@ -17,6 +17,7 @@ */ import {EventListenerCollection} from '../core.js'; +import {toError} from '../core/to-error.js'; /** * This class is used to connect Yomitan to a native component that is @@ -235,7 +236,7 @@ export class Mecab { try { await this._setupPortPromise; } catch (e) { - throw new Error(e instanceof Error ? e.message : `${e}`); + throw toError(e); } } -- cgit v1.2.3