diff --git a/src/runtime/app.ts b/src/runtime/app.ts index caca43f5..c018797c 100644 --- a/src/runtime/app.ts +++ b/src/runtime/app.ts @@ -213,6 +213,16 @@ export class App< handleError(...args: Parameters) { return handleError(...args); } + + onUnhandledError(error: Error) { + console.warn(`[Owl] Unhandled error. Destroying the root component`); + try { + this.destroy(); + } catch (e) { + console.error(e); + } + throw error; + } } export async function mount< diff --git a/src/runtime/error_handling.ts b/src/runtime/error_handling.ts index 4b4134d6..8a51001a 100644 --- a/src/runtime/error_handling.ts +++ b/src/runtime/error_handling.ts @@ -65,12 +65,6 @@ export function handleError(params: ErrorParams) { const handled = _handleError(node, error); if (!handled) { - console.warn(`[Owl] Unhandled error. Destroying the root component`); - try { - node.app.destroy(); - } catch (e) { - console.error(e); - } - throw error; + node.app.onUnhandledError(error); } }