webpack
webpack copied to clipboard
Aggregate errors or errors with cause are not logged
Bug report
What is the current behavior?
If an AggregateError or Error with cause is thrown, Webpack intercepts and only logs the primary message. For these cases, that message is often just an annotation on the real error, making it impossible to debug them from a Webpack plugin.
If the current behavior is a bug, please provide the steps to reproduce.
Throw an instance of AggregateError or an instance of Error with a cause property from any plugin, and then just examine the console output.
What is the expected behavior?
- For
AggregateError, each of theerrorsshould be logged - For
Errorwithcause, thecauseshould be logged as well
Other relevant information: webpack version: 5.89.0 Node.js version: 20 Operating System: Linux Additional tools:
I seem to have the same problem.
I tried the following in NestJS with nest start --watch:
try {
await this.createEventStream()
} catch (error) {
throw new Error('creating stream', { cause: error })
}
In the terminal I see that the cause is not logged:
.../src/subscriber/subscriber.service.ts:44
throw new Error('creating stream', { cause: error })
^
Error: creating stream
at SubscriberService.onModuleInit (.../src/subscriber/subscriber.service.ts:44:13)
at async Promise.all (index 1)
at callModuleInitHook (.../node_modules/@nestjs/core/hooks/on-module-init.hook.js:43:5)
at NestApplication.callInitHook (.../node_modules/@nestjs/core/nest-application-context.js:223:13)
at NestApplication.init (.../node_modules/@nestjs/core/nest-application.js:100:9)
at NestApplication.listen (.../node_modules/@nestjs/core/nest-application.js:169:33)
at bootstrap (.../src/main.ts:18:3)
When I run nest build and then node dist/main, I have the expected stack trace:
.../dist/subscriber/subscriber.service.js:37
throw new Error('creating stream', { cause: error });
^
Error: creating stream
at SubscriberService.onModuleInit (.../dist/subscriber/subscriber.service.js:37:19)
at async Promise.all (index 1)
at async callModuleInitHook (.../node_modules/@nestjs/core/hooks/on-module-init.hook.js:43:5)
at async NestApplication.callInitHook (.../node_modules/@nestjs/core/nest-application-context.js:223:13)
at async NestApplication.init (.../node_modules/@nestjs/core/nest-application.js:100:9)
at async NestApplication.listen (.../node_modules/@nestjs/core/nest-application.js:169:33)
at async bootstrap (.../dist/main.js:15:5) {
[cause]: NatsError: TIMEOUT
at NatsError.errorForCode (.../node_modules/nats/lib/nats-base-client/core.js:140:16)
at timeout (.../node_modules/nats/lib/nats-base-client/util.js:57:48)
at new RequestOne (.../node_modules/nats/lib/nats-base-client/request.js:103:41)
at NatsConnectionImpl.request (.../node_modules/nats/lib/nats-base-client/nats.js:349:23)
at JetStreamManagerImpl.<anonymous> (.../node_modules/nats/lib/jetstream/jsbaseclient_api.js:73:37)
at Generator.next (<anonymous>)
at .../node_modules/nats/lib/jetstream/jsbaseclient_api.js:22:71
at new Promise (<anonymous>)
at __awaiter (.../node_modules/nats/lib/jetstream/jsbaseclient_api.js:18:12)
at JetStreamManagerImpl._request (.../node_modules/nats/lib/jetstream/jsbaseclient_api.js:66:16) {
code: 'TIMEOUT',
chainedError: undefined
}
}
The webpack version that is used by nest cli is 5.90.1.
Feel free to send a PR
In my case it seems it's not webpack, my error is logged somewhere else in Nest.
@steverep could you send a minimum code that could reproduce this error?
This issue had no activity for at least three months.
It's subject to automatic issue closing if there is no activity in the next 15 days.
Still an issue