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

Add support for showing stacktrace of Error Causes in log output. #11411

Closed
1 task done
ttyniwa opened this issue Mar 30, 2023 · 1 comment
Closed
1 task done

Add support for showing stacktrace of Error Causes in log output. #11411

ttyniwa opened this issue Mar 30, 2023 · 1 comment
Labels
needs triage This issue has not been looked into type: enhancement 🐺

Comments

@ttyniwa
Copy link

ttyniwa commented Mar 30, 2023

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

The default error log doesn't show causes like below.

Error: Oops!!
    at bar (/path/to/src/sub/foo.ts:2:9)
    at hoge (/path/to/src/index.ts:4:13)

Describe the solution you'd like

Follows the Error.cause in order and outputs all stack traces.
Perhaps this can be accomplished by rewriting the log output at L72 of the BaseExceptionFilter.
https://github.com/nestjs/nest/blob/master/packages/core/exceptions/base-exception-filter.ts#L72

Teachability, documentation, adoption, migration strategy

A sample of the output is as follows.

Error: Oops!!
    at bar (/path/to/src/sub/foo.ts:2:9)
    at foo (/path/to/src/index.ts:4:13)
Caused by: OriginalError: Oops!!
    at bar (/path/to/src/sub/foo.ts:2:9)
    at foo (/path/to/src/index.ts:4:13)

This output is similar in format to FireFox.
image

What is the motivation / use case for changing the behavior?

Same as #10392

@ttyniwa ttyniwa added needs triage This issue has not been looked into type: enhancement 🐺 labels Mar 30, 2023
@kamilmysliwiec
Copy link
Member

Thanks for your suggestion!

There are no plans to implement it in the foreseeable future.

If you think your request could live outside Nest's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

@nestjs nestjs locked and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into type: enhancement 🐺
Projects
None yet
Development

No branches or pull requests

2 participants