console.error enhancement · Issue #4452 · nodejs/node (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@DylanPiercey

Description

@DylanPiercey

I'm not sure exactly how this works and if this is the right place to raise the issue but:

In the browser (chrome)

console.error(new Error);

// Logs the error and an expandable stack trace. Error(…) (anonymous function) @ VM297:2 InjectedScript._evaluateOn @VM174:878 InjectedScript._evaluateAndWrap @ VM174:811 InjectedScript.evaluate @ VM174:667

In node:

console.error(new Error) [Error]

// To properly show the stack trace I would have to console.error the stack. // In the browser this causes the stack to be visible twice. console.error((new Error).stack)

Is it possible to make it so that node will automatically add stack traces on console.error?