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

Add test for extending native errors w/o altering prototype #106

Merged

Conversation

jonchurch
Copy link
Member

This adds a test to assert on behavior outlined in the docs but not captured in the test suite.

https://github.com/jshttp/http-errors?tab=readme-ov-file#createerrorstatus-error-properties

createError([status], [error], [properties])

Extend the given error object with createError.HttpError
properties. This will not alter the inheritance of the given
error object, and the modified error object is the
return value.

@jonchurch jonchurch added the tests label Mar 9, 2024
@carpasse
Copy link
Contributor

carpasse commented May 8, 2024

This change looks good to me.
@jonchurch CI should stop failing if you rebase your branch against master.

looking at this ci again, idk why it even passed under old node versions
that dont support const, seems sus
@jonchurch jonchurch merged commit a56fde9 into jshttp:master Feb 5, 2025
24 checks passed
@jonchurch jonchurch deleted the jonchurch/native-error-extension-test branch February 5, 2025 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants