]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): make errorCaptured return value handling consistent with Vue 2...
authorᴜɴвʏтᴇ <i@shangyes.net>
Mon, 5 Oct 2020 21:37:26 +0000 (05:37 +0800)
committerGitHub <noreply@github.com>
Mon, 5 Oct 2020 21:37:26 +0000 (17:37 -0400)
fix #2267

packages/runtime-core/__tests__/components/Suspense.spec.ts
packages/runtime-core/__tests__/errorHandling.spec.ts
packages/runtime-core/src/errorHandling.ts

index c6ab0f3fa327c08c9430cce3fc2d7df0467f3a1a..5602b4a7f14ae4e2f2e5d7a2b449ca73805b6290 100644 (file)
@@ -609,7 +609,7 @@ describe('Suspense', () => {
             err instanceof Error
               ? err.message
               : `A non-Error value thrown: ${err}`
-          return true
+          return false
         })
 
         return () =>
index 47d6c4892627e1faaaf31525a280000e63629bc4..eed679136333c7fa176a516d51134d3a80ff4f30 100644 (file)
@@ -20,7 +20,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info, 'root')
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -58,7 +58,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info, 'root')
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -68,7 +68,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info, 'child')
-          return true
+          return false
         })
         return () => h(GrandChild)
       }
@@ -96,7 +96,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -126,7 +126,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -164,7 +164,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -189,7 +189,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -218,7 +218,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -238,7 +238,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -265,7 +265,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -295,7 +295,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -330,7 +330,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () => h(Child)
       }
@@ -363,7 +363,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () =>
           h(Child, {
@@ -393,7 +393,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () =>
           h(Child, {
@@ -431,7 +431,7 @@ describe('error handling', () => {
       setup() {
         onErrorCaptured((err, instance, info) => {
           fn(err, info)
-          return true
+          return false
         })
         return () =>
           h(Child, {
index 1823f6b729cc7a8cb94a26d36855ed9940c12ec0..fedb0f83f01f5a84659eb3c915db5dd2c9e31a7f 100644 (file)
@@ -113,7 +113,9 @@ export function handleError(
       const errorCapturedHooks = cur.ec
       if (errorCapturedHooks) {
         for (let i = 0; i < errorCapturedHooks.length; i++) {
-          if (errorCapturedHooks[i](err, exposedInstance, errorInfo)) {
+          if (
+            errorCapturedHooks[i](err, exposedInstance, errorInfo) === false
+          ) {
             return
           }
         }