-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor error with enum codes #123
Conversation
Codecov Report
@@ Coverage Diff @@
## master #123 +/- ##
==========================================
- Coverage 80.95% 76.73% -4.22%
==========================================
Files 22 23 +1
Lines 924 950 +26
Branches 243 249 +6
==========================================
- Hits 748 729 -19
- Misses 141 185 +44
- Partials 35 36 +1
Continue to review full report at Codecov.
|
src/errors-new.ts
Outdated
to?: RouteLocation | ||
} | ||
|
||
const ErrorTypeMessages = { |
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.
I think we need some kind of logError
method, similar to vue-next. In our case error codes are part of the public api but I think the messages should only be logged in dev mode and just print the error in prod
At this point I wonder if message
should just be kept empty 🤔
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.
I added a __DEV__
check to remove it in prod build. logError
seems unnecessary as we're not catching all errors then print/rethrow them like in core, maybe?
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.
This is starting to look great!
I'm still concerned about the names but we can change that after merging this. Although it's a great opportunity to get others involved:
- Aborted / Cancelled are too similar and will lead to confusion. Do we even need 2 different kind of errors? Even when thinking about other names like dropped, it fits both cases:
next(false)
- A newer
push
/replace
being called while the navigation was ongoing
I think it's worth splitting up the error codes: Navigation Errors (exported and can be used by users) and others like the matcher error that are used internally and we want to (at least for the moment) keep private
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.
Let's merge this and start a discussion regarding what navigation failures need to be exposed
No description provided.