You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an error variable that I caught from somewhere else. I would like to log it cleanly to console just like this library does. However, from the readme, it looks like this library only acts on uncaught errors. Does this library also provide a way to do this?
The text was updated successfully, but these errors were encountered:
At the moment, the logic related to error formatting is not decoupled from the logic related to error handling, so you would need to handle the errors using log-process-errors to benefit from the error formatting.
One thing to keep in mind is that the error formatting needs not only the error instance, but also any properties passed to the process event. For example, in process.on('unhandledPromise', (error, promise) => {...}, both error and promise are printed by the error formatter (since they are both interesting). So if we were to decouple error formatting, users would need to pass those arguments along as well. Although we could make those additional arguments optional (but the output will be less informative).
Decoupling the formatting logic is not completely straightforward though, so I'd like to ask you: would the log option be a solution for you? This would require you to catch the error using log-process-errors, but you would still be able to run your custom logic.
I have an
error
variable that I caught from somewhere else. I would like to log it cleanly to console just like this library does. However, from the readme, it looks like this library only acts on uncaught errors. Does this library also provide a way to do this?The text was updated successfully, but these errors were encountered: