notifyThrown()function
notifyThrown(thrown: unknown, el?: EventTarget): void
| Param | Type | |
|---|---|---|
thrown | unknown | The thrown value to report. required |
el | EventTarget | Element to dispatch the event on (defaults to window). |
Look at a thrown value, extract a viable message from it, and dispatch an error notice.
- Uses
getMessage()to pull a human-readable string from the thrown value. - Falls back to a generic
"Unknown error"notice andconsole.error()when no message can be extracted.
Examples
try { await save(); } catch (thrown) { notifyThrown(thrown); }