diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-01-15 06:12:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 11:12:33 +0000 |
commit | 48f1d012ad5045319d4e492dfbefa39da92817b2 (patch) | |
tree | 51b5b53a7b1192f04a8292c3a9aa0f5063c64b46 /ext/js/display/display.js | |
parent | 9cfa20cbd2289d82a5abf05a2e5ea8af5016222c (diff) |
Add toError utility function (#523)
* Add asError utility function
* Rename to toError
Diffstat (limited to 'ext/js/display/display.js')
-rw-r--r-- | ext/js/display/display.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js index ff77d203..7e7dd426 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -21,6 +21,7 @@ import {FrameEndpoint} from '../comm/frame-endpoint.js'; import {DynamicProperty, EventDispatcher, EventListenerCollection, clone, deepEqual, log, promiseTimeout} from '../core.js'; import {extendApiMap, invokeApiMapHandler} from '../core/api-map.js'; import {ExtensionError} from '../core/extension-error.js'; +import {toError} from '../core/to-error.js'; import {PopupMenu} from '../dom/popup-menu.js'; import {querySelectorNotNull} from '../dom/query-selector.js'; import {ScrollElement} from '../dom/scroll-element.js'; @@ -787,7 +788,7 @@ export class Display extends EventDispatcher { break; } } catch (e) { - this.onError(e instanceof Error ? e : new Error(`${e}`)); + this.onError(toError(e)); } } @@ -922,7 +923,7 @@ export class Display extends EventDispatcher { }; this.setContent(details); } catch (error) { - this.onError(error instanceof Error ? error : new Error(`${error}`)); + this.onError(toError(error)); } } |