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

[FEATURE] Add new constructors to the Error classes that support error options #713

Closed
toddbaert opened this issue Jan 2, 2024 · 3 comments · Fixed by open-feature/js-sdk#765
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@toddbaert
Copy link
Member

We should add constructors to the Error classes that support error options, to specifically support cause. This allows us to embed causal errors into rethrown errors. It's supported in browsers as well.

Originally posted by @toddbaert in #708 (comment)

@toddbaert toddbaert added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jan 2, 2024
@NeerajGartia21
Copy link

I would like to work on this issue. Can you please elaborate it a little bit more.

@toddbaert
Copy link
Member Author

We need to support additional parameters to the Error classes in the SDK at packages/shared/src/errors. ES2022 supports this (node16+ and all modern browsers). We should add additional optional parameters or additional constructors that correspond to ErrorOptions, which will allow us to add a cause.

We will have to update our compiler options to ES2022 to support this.

Let me know if that makes it more clear and I will assign to you.

@NeerajGartia21
Copy link

It's more clear now. I can start working on this. Could you please assign it to me.

github-merge-queue bot pushed a commit to open-feature/js-sdk that referenced this issue Jan 20, 2024
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

- adds `ErrorOptions` to `Error` constructor
- updates compiler option to `es2022`

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

Fixes [this](open-feature/js-sdk-contrib#713)

### Notes
<!-- any additional notes for this PR -->

### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->

### How to test
<!-- if applicable, add testing instructions under this section -->

---------

Signed-off-by: Neeraj Gartia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants