honeybadger-io / honeybadger-go

Send Go (golang) panics and errors to Honeybadger.
https://www.honeybadger.io/
MIT License
34 stars 15 forks source link

Publicizing stack frame generation #21

Closed bobbytables closed 7 years ago

bobbytables commented 7 years ago

Hi! We currently use Logrus + Hooks to dispatch errors to Honeybadger using the package https://github.com/bobbytables/logrus-honeybadger

We've noticed that the Class when using Go typically defaults to *errors.errorString, usually because of this line: https://github.com/honeybadger-io/honeybadger-go/blob/master/error.go#L50

This can be solved by calling Notify on the client with the honeybadger.Error type where you can set the Class struct property manually. However, getting the frames for the current stacktrace is an unexported function in this package.

So what I'm proposing is to export the function defined here https://github.com/honeybadger-io/honeybadger-go/blob/master/error.go#L55

This would allow generating the Error type very easy to pass into the Notify function.

joshuap commented 7 years ago

Hey @bobbytables, you can actually already override the class name when calling Notify, like this:

honeybadger.Notify(err, honeybadger.ErrorClass{"CustomClassName"})

See the Notify examples section for more info

Would that work instead?