-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Move assertion messages into code and deprecate AssertionError #14030
Conversation
📦 Preview the website for this branch here: https://deploy-preview-14030--ol-site.netlify.app/. |
src/ol/AssertionError.js
Outdated
'/doc/errors/#' + | ||
code + | ||
' for details.'; | ||
const message = `Assertion failed. ${messages[code]}.`; |
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'd be in favor of simplifying this to just messages[code]
. I think the "Assertion failed" part of the message isn't meaningful and potentially confusing to users.
changelog/upgrade-notes.md
Outdated
Future versions will no longer throw `ol/AssertionError` with an error `code`. Instead, they will throw `Error` with just the error message. | ||
|
||
### v7.0.0 | ||
|
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 file looks out of date
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.
Indeed. I just rebased the pull request.
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, @ahocevar
0165885
to
bb5eaac
Compare
bb5eaac
to
a04ff79
Compare
Fixes #14028.
I think it's best to keep the same codes for now, even though some are duplicated, in case anyone relies on them. And to deprecate
ol/AssertionError
in favor of throwing plainError
s instead, starting with the next major version. What do others think?