-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I'm using this package together with make-error-cause, which extends errors with a cause property and overrides the custom inspect function to generate a long stack trace including the cause:
https://github.com/blakeembrey/make-error-cause/blob/master/src/index.ts
This module however does not use util.inspect() to generate stack traces, instead it accesses .stack directly so the "extended" stack trace is not printed.
I would appreciate if this could get fixed.
Simple repro case:
process.env.DEBUG = '*';
const { BaseError } = require('make-error-cause');
const log = require('debug-logger')('test');
let cause = new Error('cause');
let e = new BaseError('error', cause);
log.error(e);Output:
test:error BaseError: error
test:error ___Stack trace #1___
test:error BaseError: error
test:error at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:7:9)
test:error at Module._compile (internal/modules/cjs/loader.js:776:30)
test:error at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
test:error at Module.load (internal/modules/cjs/loader.js:643:32)
test:error at Function.Module._load (internal/modules/cjs/loader.js:556:12)
test:error at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
test:error at internal/main/run_main_module.js:17:11 +0ms
Expected output:
test:error BaseError: error
test:error ___Stack trace #1___
test:error BaseError: error
test:error at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:7:9)
test:error at Module._compile (internal/modules/cjs/loader.js:776:30)
test:error at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
test:error at Module.load (internal/modules/cjs/loader.js:643:32)
test:error at Function.Module._load (internal/modules/cjs/loader.js:556:12)
test:error at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
test:error at internal/main/run_main_module.js:17:11
test:error
test:error The following exception was the direct cause of the above exception:
test:error
test:error Error: cause
test:error at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:6:13)
test:error at Module._compile (internal/modules/cjs/loader.js:776:30)
test:error at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
test:error at Module.load (internal/modules/cjs/loader.js:643:32)
test:error at Function.Module._load (internal/modules/cjs/loader.js:556:12)
test:error at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
test:error at internal/main/run_main_module.js:17:11 +0ms
Metadata
Metadata
Assignees
Labels
No labels