getsentry / raven-go

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

Add Client.SetSkipFrames #76

Open jotto opened 8 years ago

jotto commented 8 years ago

Add SetSkipFrames so wrapper libraries can optionally hide their lines/frames from the stacktrace

mattrobenolt commented 8 years ago

Why is this needed on the Client as a whole? Seems bad to assume that any exception will always have the exact same number of frames to skip considering a Client is initialized globally.

This would make more sense imo on a per-Capture thing.

jotto commented 8 years ago

Why is this needed on the Client as a whole

The use case is specifically for a "wrapper" library. Concretely, a logging/error library with a LogError method that sends errors to both logging and various error reporting services. Thus, when calling myinternallibrary.LogError, which calls Raven.CaptureError, the stack trace (before this PR) includes myinternallibrary

Moving it to the Capture method signature seems more flexible, but harder to architect (how do you put it in any existing method signatures... do we create a new method?)

We used the SetSkipFrames to follow the same style as SetIncludePaths.