-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle Rejections functionality is not working #1673
Comments
Any progress on this? |
Any update on this? The documentation of |
I think this is fixed with #1779 and can be closed? |
Probably, and winston-transport was released 2 months ago with required change too. I will re-test with latest version |
Looks like issue is fixed, but only if |
Still not working |
it looks like on winston@3.3.3 setting
and following will write
|
Sadly, the neat workaround offered by @rizwan-hanif does not work for transports.Console let defaultTransport =
new LOG.transports.Console({
level: logLevel,
handleExceptions: true,
handleRejections: true,
}); Argument of type '{ level: string; handleExceptions: true; handleRejections: boolean; }' is not assignable to parameter of type 'ConsoleTransportOptions'. |
@quickdraw6906 issue is of
|
Thanks so much! |
winston
version?winston@2
winston@3
node -v
outputs: v10.16.0What is the problem?
In both below cases nodejs will print default unhandled rejection error
handleRejections
flag totrue
during transport creation is not workingWhat do you expect to happen instead?
Winston should intercept unhandled rejection and log it
Other information
1st problem is due to not released change in winston-transport package: winstonjs/winston-transport#47
2nd problem is due to typo in
_addHandler
method oflib/winston/rejection-handler.js
:winston/lib/winston/rejection-handler.js
Line 153 in 15c9653
This line should be ADDED
handler.handleRejections = true
There is one important thing: without handleExceptions, handleRejections won't log anything, due to below check: https://github.com/winstonjs/winston-transport/blob/46db8f3c8cd8b106ade8d7e04a191ee388683d60/index.js#L70
Testcases
Fails
Succeeds (Trick is in using
Object.assign
on transport instance)The text was updated successfully, but these errors were encountered: