Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Extending error object in express, but Debug does only show the stack trace

Open
#711 5 comments 2 reactions 0 assignees View on GitHub

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
Domain
backend, devtools

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

bug

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from debug-js/debug

All issues in debug-js/debug

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.