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

feat: allow boomifying any value (#291) #293

Closed
wants to merge 1 commit into from
Closed

feat: allow boomifying any value (#291) #293

wants to merge 1 commit into from

Conversation

matthieusieben
Copy link

Creation of a new boomifyAny that allows creating a boom error from an unknown value.

This is a proposed fix for #291

Creation of a new boomifyAny that allows creating a boom error from an
"unknown" value.

Refs #291
Copy link
Member

@Nargonath Nargonath left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. We'd need some tests for the runtime behaviour and also for the types (test/index.js and test/index.ts).

Not sure if we want to relax the current API or provide this new function though.

@matthieusieben
Copy link
Author

matthieusieben commented May 6, 2022

Please tell me if you are ready to accept before I implement the tests.

For context, here is how this would be used:

try {
  // some code that throw using non-error
} catch (err) {
  // in TypeScript err is of type unknown
  throw boomifyAny(err, { message: 'Unexpected error while performing code that throws non-error' })
}

@kanongil
Copy link
Contributor

kanongil commented May 6, 2022

Personally, I would much prefer to do a breaking change to boomify, as suggested in #291 (comment), which would also update the argument type to any.

@matthieusieben
Copy link
Author

matthieusieben commented May 6, 2022

Edit moved comment to #291 (comment)

@matthieusieben matthieusieben closed this by deleting the head repository Nov 4, 2022
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.

None yet

3 participants