Skip to content

Instantly share code, notes, and snippets.

@shalakhin
Last active August 29, 2015 13:57
Show Gist options
  • Save shalakhin/9441644 to your computer and use it in GitHub Desktop.
Save shalakhin/9441644 to your computer and use it in GitHub Desktop.
using raven-go properly
// trace generates raven traceback
func trace() *raven.Stacktrace {
return raven.NewStacktrace(0, 3, []string{"myproject"})
}
// HandleError handles error like logging, mail notification.
func HandleError(err error) {
packet := &raven.Packet{Message: err.Error(), Interfaces: []raven.Interface{raven.NewException(err, trace())}}
// here we use Sentry instance created once in config instead of instantiating it every time
config.Config.Sentry.Client.Capture(packet, nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment