Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Apr 19, 2023

Description

This pull request is to enable unknown values to be used as the cause of an error. Previously, only the Error type
was allowed as a cause of error. However, any value may cause an error to occur, not just an Error value. Therefore,
it becomes necessary to allow other types to be used as error causes.

Changes

  1. Allow unknown values as error causes.

Previously, only the `Error` type as accepted as cause, but since any value can be thrown as error, we have to allow any value to be used.
@Mrtenz Mrtenz requested a review from a team as a code owner April 19, 2023 09:21
const error = rpcErrors.invalidInput({
data: {
foo: 'bar',
cause: 'foo',
Copy link
Member

Choose a reason for hiding this comment

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

What happens when this is not JSON-serializable?

Copy link
Member Author

Choose a reason for hiding this comment

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

null is used.

@Mrtenz Mrtenz merged commit e06f8d8 into main Apr 19, 2023
@Mrtenz Mrtenz deleted the mrtenz/unknown-error branch April 19, 2023 09:40
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.

4 participants