-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure global onError called on abortation. Example provided. (repo) #3287
Conversation
@posva The first line gonna call onError, the second one not gonna call it, we can't hook anything else, there's no global way for hooking Before Router Enter stoping on FALSE beforeRouteEnter(to, from, next){
if(1){
next(new Error('This gonna call onError global route Hook'); // This gonna call onError global route Hook
return;
}
if(1){
next(false); // but that's not, this call only onAbort local route link.
return;
}
} // IT'S CALLED ONLY ON new Error instances, Not called on next(false)
router.onError((err)=>{
console.log('Something returned ERROR inside beforeRouterEnter hook',err);
})
// GLOBAL NOT LOCAL, STILL NOT IMPLEMENTED
router.onAbort((err)=>{
console.log('Something returned false inside beforeRouterEnter hook',err);
}) Originally posted by @afwn90cj93201nixr2e1re in #3287 (comment) |
This PR shouldn't be merged, coz onError should be called only on Errors not on false too... This PR is only for you, coz you still don't understand the issue, and just reading few first lines without taking look to a code. |
Something like |
Thanks for answer, im very happy, now u get what im talking about... https://codesandbox.io/s/vue-routing-example-pfhhb That's an example for you.
I don't think so onError wasn't changed only Navigation Failures was refactored, it's don't have any realtion with global hooks, global hooks wasn't changed, we are just expanding it, i checked out both version and v4 and 2.8 everywhere it's can be added, onAbort should be called only on false returning, so, there's 1 line code chaning and onAbort defenitions in both version in 2.8 and in 4.x Just place onAbort nearby onError. Waiting for response. |
Also you can look up to screenshot: |
Also can you create new Issue with explanation that we need onAbort? Coz you gonna lost this idea again, as in 2019 october... Also i sent this pr especially for 2.8 branch version, not for 4. Adding new onAbort not really gonna hurt new logic from v4... |
3.x is different from 2.x We expect people to communicate in a more respectful way in Vue to keep things welcoming a for everybody |
No description provided.