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 Error .cause property to output #3186
Comments
If my understanding of the codebase is right? It looks like you'd need to add |
Alternatively the line above: Line 109 in 678f9ca
That function is pretty old, there must be a better alternative nowadays. If the cause has a cause, how do you suggest we format that? |
The most simple would be to tack it on after the original error with some sort of I think getting any more fancy than that would be annoying to parse out with the eyes. Especially with the limits of CLI. So the same formatting as the current error, but just duplicated below for the cause under a |
Ava does not currently output an information related the Error.cause property.
Error.cause is somewhat new with support in NodeJS 16+, Deno 1.13+, and major browsers since ~September 2021. The
.cause
property can contain anotherError
which is useful when tracing re-throws. But, it can be of any type. It's currently supported .When you
console.log
such an Error with .cause of another Error in the options, you get something like the followingTranscription of above image
When
.cause
is just structured data, a string representation of that data is output after[cause]:
For comparison, in Ava, when you throw an error with a cause, the cause is omitted
Transcription of above image
It would be nice for Ava to show the
.cause
in some form.The text was updated successfully, but these errors were encountered: