-
Notifications
You must be signed in to change notification settings - Fork 220
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
Export function that builds error chain from wrapped errors #291
Comments
Have you tried |
Thanks, I think the Scope.AddEventProcessor should allow me to do what I need. I want to build a sentry hook for logrus so that errors are sent to sentry automatically when they are logged from logrus. A logrus error log would include the error (or error chain), a message and any additional context as key value pairs. I can set the additional data on the scope, but Hub.CaptureException doesn't allow adding a message. I think I can use an EventProcessor to set the message, but it seems a bit overkill to use it just to set a field I already had when the event was created. So I would still prefer access to this function if possible. |
^ +1 I want logging with the error chain, a custom message, and contextual data |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Can we reopen this issue? I am trying to accomplish the same as here: create a custom logger that automatically sends events to Sentry in addition to logging them. The easiest way to do this is to create a The easiest way to add exceptions to this event would be by using the Adding a new public method such as |
We did merge and released a Logrus integration (#471) a while ago. |
Logrus is now in maintenance mode, with newer libraries such as zerolog and zap offering better performance. What would be nice is to be able to build a custom logger implementation that wraps any number of logging/event capturing solutions (Sentry, Logrus, zerolog, zap) instead of being tightly coupled to Sentry via hooks. |
I can't come up with an immediate answer to why we shouldn't export these two functions. |
Summary
Please export a function that can build an error chain from a wrapped error.
Motivation
This package has logic that builds an error chain for an event from errors that are wrapped using several different error packages. However, this logic is in a function that builds an event and submits it immediately. I would like to be able to use this logic so that I can make further changes to the event before submitting it.
Additional Context
The simplest way to achieve this would be to export Client.eventFromException which builds an event from an error. The function doesn't depend on the client receiver so it's trivial to change it to a standalone function.
It might be better to create a function with a different signature though, e.g.
func ExtractErrorChain(err error) []Exception
The text was updated successfully, but these errors were encountered: