-
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
[3.0.0-rc] Exception during formatting kills logging #1261
Comments
The thrown error has caused an ... alternatively it could be up to you the caller who swallowed the error to reconnect everything. |
The only reason that would be viable for me is because I am using a custom wrapper to
I agree that any format should handle potential errors. However, we all know that not all errors are foreseen and many occur in rare cases. For example, #1248 identifies a case where some objects will cause an Of course, if that error goes unhandled AND the app is following best practices, the application will terminate. HOWEVER, most logging is done alongside other code which will often be wrapped inside try/catch blocks that will are designed to handle the functional failures rather than the logging failures. Interpreting logging failures as functional failures can cause a host of new side effects; it is impractical to train each such catch block to uniquely handle logging errors. We're left with the standard practice being one big try/catch inside every non-trivial
Yeah... I totally understand that. Without the knowledge of what the formatter was trying to do, how can you meaningfully handle exceptions that come out of it? Maybe, the best that can be done is to catch an error coming out of the call to |
@indexzero Any additional thoughts on this? |
@crussell52 it's a blocker on our Roadmap so it's definitely going to get handled before the |
@crussell52 dug in and discovered that the silencing was due to the |
* [fix] Wrap calls to `format.transform` with try / catch. Potential fix for #1261. * [test] Test error trapping for user-defined formats.
Fixed in #1347. Will be released later today in |
* [fix] Wrap calls to `format.transform` with try / catch. Potential fix for winstonjs#1261. * [test] Test error trapping for user-defined formats.
If a formatter throws an exception, logging stops working -- even if the exception is handled.
Related: #1248,
Possibly Related: #1144
Recreation:
The text was updated successfully, but these errors were encountered: