fix(runtime-core): make errorCaptured return value handling consistent with Vue 2 (#2289)

fix #2267
This commit is contained in:
ᴜɴвʏтᴇ 2020-10-06 05:37:26 +08:00 committed by GitHub
parent ea1f87eabf
commit 4d20ac8173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 17 deletions

View File

@ -609,7 +609,7 @@ describe('Suspense', () => {
err instanceof Error
? err.message
: `A non-Error value thrown: ${err}`
return true
return false
})
return () =>

View 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, {

View 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
}
}