Skip to content

Bug: getErrorTrace(error) is undefined on custom errors #313

@kinton

Description

@kinton

Describe the bug
TypeError undefined is not an object (evaluating 'getErrorTrace(error).map') on custom errors

To Reproduce
Steps to reproduce the behavior:

console.log(err, String(err), String(typeof err));
logger.error(
Error in custom middleware: ${middleware}:,
err
);

Output:
(The console.log)
ConnectionRefused: Unable to connect. Is the computer able to access the url?
path: "http://localhost:3000/user"
ConnectionRefused: Unable to connect. Is the computer able to access the url? object

(The Bug)
TypeError undefined is not an object (evaluating 'getErrorTrace(error).map'), 58, 45, 58, 45, node_modules/tslog/dist/esm/runtime/nodejs/index.js
error stack:
• index.js prettyFormatErrorObj
node_modules/tslog/dist/esm/runtime/nodejs/index.js:87
• index.js
node_modules/tslog/dist/esm/runtime/nodejs/index.js:82
• ...

Expected behavior
Ignore the error or print without pretty mode.

Bun Version
1.1.12

OS incl. Version
macOS 15.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions