Extending error object in express, but Debug does only show the stack trace
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 32/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- express, javascript, node.js
Research direction
Reproduce the Express error-handling middleware shown in the issue, comparing console.log(error) with debug output. Read the debug package's error-formatting behavior and verify whether the object properties are intentionally omitted; done means the behavior is fixed or clearly documented with a supported way to display the full error object.
Written by the indexing model from the issue text.
Description
Hello,
Small question of which I don't know it's a bug or expected behaviour:
In my express application I have the following app.use at the bottom:
app.use( (error, req, res, next) => {
const status = error.statusCode || 500;
const source = error.source || 'Unknown';
const message = error.message;
const info = error.info || '';
console.log(error); // For logging on the server
res.status(status).json({
status: status,
source: source,
message: message,
info: info
})
});
This shows me the stack trace and the error object (with source and info properties).
When I change the console.log to debug, it only shows the stack trace and not the error object.
Why is that? And how can I show the error object with the debug command also?
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 992
- PR merge metrics
- No merged PRs in 30d
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.
More from debug-js/debug
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Debug as JSON Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
Similar issues
-
bug customer-eng Durable Agents Inngest status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/OrgExplorer#253 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100