Skip to content
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

Merged
merged 2 commits into from
Aug 22, 2022

Conversation

ahocevar
Copy link
Member

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 plain Errors instead, starting with the next major version. What do others think?

@github-actions
Copy link

📦 Preview the website for this branch here: https://deploy-preview-14030--ol-site.netlify.app/.

'/doc/errors/#' +
code +
' for details.';
const message = `Assertion failed. ${messages[code]}.`;
Copy link
Member

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.

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

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@tschaub tschaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ahocevar

@ahocevar ahocevar force-pushed the assert-messages branch 2 times, most recently from 0165885 to bb5eaac Compare August 22, 2022 07:19
@ahocevar ahocevar merged commit a69c88c into openlayers:main Aug 22, 2022
@ahocevar ahocevar deleted the assert-messages branch August 22, 2022 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v7.0.0 assertion urls lead to 404
2 participants