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

feat: show stack-trace of unhandled errors with DEBUG env #212

Merged
merged 6 commits into from
May 10, 2022

Conversation

tobiasdiez
Copy link
Contributor

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

If an unhandled error occurs somewhere, nito only prints the error message. This makes it hard to locate where the error occurs and how to fix it. With this PR, the full stacktrace is printed for an error.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0
Copy link
Member

pi0 commented May 9, 2022

Hi @tobiasdiez, and thanks for this PR. But normally, all Promise errors should be handled. These handles are just a fallback to ensure Node.js doesn't exit the process.

We might support showing full stacks on fallback behind an environment variable flag like proces.env.DEBUG.

But I would also like to know your usage that ends with unhandled flags.

@tobiasdiez
Copy link
Contributor Author

Very early in the migration to nuxt3, I've encountered an error that was only printed through these "unhandled" error handlers. I sadly don't remember the exact context, but I added the the detailed error reporting in JabRef/JabRefOnline@20fac0a, so maybe something related to the runtime config.

If I encounter this again, I'll let you know where/why it occurred.

@pi0 pi0 changed the title fix: improve error handler to include stacktrace feat: show stack trace of unhandled errors with DEBUG env May 10, 2022
@pi0 pi0 changed the title feat: show stack trace of unhandled errors with DEBUG env feat: show stack-trace of unhandled errors with DEBUG env May 10, 2022
@pi0 pi0 merged commit b366f3f into unjs:main May 10, 2022
@tobiasdiez tobiasdiez deleted the patch-1 branch May 10, 2022 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants