getsentry / raven-go

Sentry client in Go
https://sentry.io
BSD 3-Clause "New" or "Revised" License
561 stars 148 forks source link

Error context lost when submitting to sentry via raven #176

Closed bfosberry closed 6 years ago

bfosberry commented 6 years ago

Currently we are using pkg/errors to wrap errors and pass stacktraces, and also to wrap additional error context. This does mean that sentry unwraps those errors before sending them to sentry, dropping all of that additional context. What is the best practice for keeping this context and associating it with the root stacktrace? I could add err.Error() to the tags, but that feels like a misuse of tags. It feels like CaptureError should be

    cause := pkgErrors.Cause(err)

    packet := NewPacket(err.Error(), append(append(interfaces, client.context.interfaces()...), NewException(cause, GetOrNewStacktrace(cause, 1, 3, client.includePaths)))...)

instead of

    cause := pkgErrors.Cause(err)

    packet := NewPacket(cause.Error(), append(append(interfaces, client.context.interfaces()...), NewException(cause, GetOrNewStacktrace(cause, 1, 3, client.includePaths)))...)

and preserve the wrapped error context