Last active
August 29, 2015 13:57
-
-
Save shalakhin/9441644 to your computer and use it in GitHub Desktop.
using raven-go properly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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