-
-
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
feat(errors): capture errors thrown in redirect callback in onError #3251
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks but doing a try catch around the whole navigation is too much. Shouldn't try catching the router.match be enough?
Hi @posva ! Yes you are right, try catching router.match should be enough. I just thought it might be a good idea to also catch errors in the confirmTransition. |
try catch just router.match Resolves #3201
src/history/base.js
Outdated
// https://github.com/vuejs/vue-router/issues/3201 | ||
throw e | ||
} | ||
if (route) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we throw again if we fail, I don't think we need the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I just removed it in a new commit
remove unnecessary if Resolves #3201
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Resolves #3201
This PR allows exceptions to be caught in router.onError.