Feature - optionally include Error.cause property#226
Merged
wbt merged 2 commits intowinstonjs:masterfrom Nov 24, 2022
davidnbooth:master
Merged
Feature - optionally include Error.cause property#226wbt merged 2 commits intowinstonjs:masterfrom davidnbooth:master
wbt merged 2 commits intowinstonjs:masterfrom
davidnbooth:master
Conversation
Extends options to allow emitted info to include the ES2022 Error.cause
Contributor
|
Looks pretty good to me! Will leave it open for a bit in case others have comments. |
Author
|
Thanks for the feedback! I added some tests. I wasn't 100% sure what I was doing but I think they are right. |
Author
|
Is there anything else or is it good to go? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This would extend the options (currently {stack: Boolean}) to include a "cause" option. Passing cause: true would make the emitted info include the Error.cause property and allow the fullest error logging for users who are using error causes.
I wasn't sure if the conditionals should be
if (cause)orif (cause && einfo.cause). I'd be very happy with either.For background, Error.cause is an ES2022 addition, added to node in 16.9.0.