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

print also the cause for errors if any #1203

Closed
4 tasks done
darkyzhou opened this issue Apr 28, 2022 · 3 comments
Closed
4 tasks done

print also the cause for errors if any #1203

darkyzhou opened this issue Apr 28, 2022 · 3 comments

Comments

@darkyzhou
Copy link

darkyzhou commented Apr 28, 2022

Clear and concise description of the problem

There is a new property for Error instances called cause, see here for details.

Currently vitest only prints the outer Error instance like this:

Screen Shot 2022-04-28 at 17 03 53

Since the BuildError here is just a wrapper, we can't actually tell where the original Error is thrown as well as what the stack trace is.

It would be much helpful for debugging if vitest can also print its inner cause instance, just like how JVM does(check out that Caused by part):

Exception in thread "main" java.lang.RuntimeException: Some other message
    at Exceptions.main(Exceptions.java:4)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.RuntimeException: Some message
    at Exceptions.main(Exceptions.java:3)
    ... 5 more

Suggested solution

See above

Alternative

No response

Additional context

No response

Validations

@darkyzhou darkyzhou changed the title print also cause for errors if any print also the cause for errors if any Apr 28, 2022
@darkyzhou darkyzhou changed the title print also the cause for errors if any print also the cause for errors if any Apr 28, 2022
@userquin
Copy link
Member

@darkyzhou it seems to be resolved in this PR #1202

@sheremet-va
Copy link
Member

Screenshot 2022-04-28 at 12 32 06

Yep, resolved in #1202

@darkyzhou
Copy link
Author

thank you
a nice coincidence

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants