fix(runtime-core): make errorCaptured return value handling consistent with Vue 2 (#2289)
fix #2267
This commit is contained in:
@@ -609,7 +609,7 @@ describe('Suspense', () => {
|
|||||||
err instanceof Error
|
err instanceof Error
|
||||||
? err.message
|
? err.message
|
||||||
: `A non-Error value thrown: ${err}`
|
: `A non-Error value thrown: ${err}`
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info, 'root')
|
fn(err, info, 'root')
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info, 'root')
|
fn(err, info, 'root')
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info, 'child')
|
fn(err, info, 'child')
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(GrandChild)
|
return () => h(GrandChild)
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () => h(Child)
|
return () => h(Child)
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () =>
|
return () =>
|
||||||
h(Child, {
|
h(Child, {
|
||||||
@@ -393,7 +393,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () =>
|
return () =>
|
||||||
h(Child, {
|
h(Child, {
|
||||||
@@ -431,7 +431,7 @@ describe('error handling', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
onErrorCaptured((err, instance, info) => {
|
onErrorCaptured((err, instance, info) => {
|
||||||
fn(err, info)
|
fn(err, info)
|
||||||
return true
|
return false
|
||||||
})
|
})
|
||||||
return () =>
|
return () =>
|
||||||
h(Child, {
|
h(Child, {
|
||||||
|
|||||||
@@ -113,7 +113,9 @@ export function handleError(
|
|||||||
const errorCapturedHooks = cur.ec
|
const errorCapturedHooks = cur.ec
|
||||||
if (errorCapturedHooks) {
|
if (errorCapturedHooks) {
|
||||||
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
||||||
if (errorCapturedHooks[i](err, exposedInstance, errorInfo)) {
|
if (
|
||||||
|
errorCapturedHooks[i](err, exposedInstance, errorInfo) === false
|
||||||
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user