pillarjs / pillarjs/finalhandler
Print causes when outputting error stacks
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 241
- Forks
- 54
- Avg merge
- 7h 21m
- Merged PRs (30d)
- 1
Description
In getErrorMessage, which is used to create a pretty error messages that is both logged and returned to clients in non-production environments, the error message is found by simply taking err.stack.
Errors now support the cause option (not really well-documented in Node.js documentation, but it's on MDN), which allows listing originating causes for an error (for example, if an error is thrown as the result of a different error).
err.stack does not print this, but for example browser consoles show the causes nicely:

Would you be interested in a PR adding the cause chain to the output of getErrorMessage? I think this would be a nice addition, and I would personally find it useful 😄
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in index.js at getErrorMessage, where the message currently uses err.stack. Review how the cause option is represented and define output that includes the cause chain, then verify that non-production error responses and logs include it without losing the existing stack output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100