From 7d966fdfe222c6004d80238aa2f7723f1140eb2b Mon Sep 17 00:00:00 2001 From: pikax Date: Fri, 17 Apr 2020 21:37:19 +0100 Subject: [PATCH 1/2] feat(runtime-core): expose exception if app.errorHandler throws exception --- packages/runtime-core/src/errorHandling.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/errorHandling.ts b/packages/runtime-core/src/errorHandling.ts index 095661218c6..ea1e1782342 100644 --- a/packages/runtime-core/src/errorHandling.ts +++ b/packages/runtime-core/src/errorHandling.ts @@ -68,7 +68,12 @@ export function callWithErrorHandling( try { res = args ? fn(...args) : fn() } catch (err) { - handleError(err, instance, type) + // if the error handler throws error, rethrow it + if (type === ErrorCodes.APP_ERROR_HANDLER) { + throw err + } else { + handleError(err, instance, type) + } } return res } From 602333f6b3d7a06153c02491999113dc9895f8d0 Mon Sep 17 00:00:00 2001 From: pikax Date: Fri, 17 Apr 2020 21:50:46 +0100 Subject: [PATCH 2/2] feat: add to warnHandler --- packages/runtime-core/src/errorHandling.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/errorHandling.ts b/packages/runtime-core/src/errorHandling.ts index ea1e1782342..b6f27be0445 100644 --- a/packages/runtime-core/src/errorHandling.ts +++ b/packages/runtime-core/src/errorHandling.ts @@ -69,7 +69,10 @@ export function callWithErrorHandling( res = args ? fn(...args) : fn() } catch (err) { // if the error handler throws error, rethrow it - if (type === ErrorCodes.APP_ERROR_HANDLER) { + if ( + type === ErrorCodes.APP_ERROR_HANDLER || + type === ErrorCodes.APP_WARN_HANDLER + ) { throw err } else { handleError(err, instance, type)