From 02f0449b39a7926c830364e35c49027163c84982 Mon Sep 17 00:00:00 2001 From: Howl Date: Thu, 16 Jun 2016 14:05:26 +0200 Subject: [PATCH] Stack traces are only useful for panics --- app/recovery.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/recovery.go b/app/recovery.go index 2a86cf5..bbbd471 100644 --- a/app/recovery.go +++ b/app/recovery.go @@ -18,6 +18,8 @@ func Recovery(client *raven.Client, onlyCrashes bool) gin.HandlerFunc { var requestBody []byte defer func() { + st := raven.NewStacktrace(0, 3, []string{"git.zxq.co/ripple"}) + tokenRaw, ex := c.Get("token") var token string if ex { @@ -29,8 +31,6 @@ func Recovery(client *raven.Client, onlyCrashes bool) gin.HandlerFunc { ravenHTTP.Data = string(requestBody) } - stackTrace := raven.NewStacktrace(0, 3, []string{"git.zxq.co/ripple"}) - ravenUser := &raven.User{ ID: token, IP: c.Request.RemoteAddr, @@ -54,7 +54,7 @@ func Recovery(client *raven.Client, onlyCrashes bool) gin.HandlerFunc { client.CaptureError( err, flags, - stackTrace, + st, ravenHTTP, ravenUser, ) @@ -69,7 +69,6 @@ func Recovery(client *raven.Client, onlyCrashes bool) gin.HandlerFunc { client.CaptureError( err, flags, - stackTrace, ravenHTTP, ravenUser, )