From 2464a48b1c707b33021be65308eae6bc4e459518 Mon Sep 17 00:00:00 2001 From: sangbum Kim Date: Tue, 15 Mar 2016 23:59:16 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/recovery/middleware.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/middleware/recovery/middleware.go b/middleware/recovery/middleware.go index 1c522d9..eb1b75d 100644 --- a/middleware/recovery/middleware.go +++ b/middleware/recovery/middleware.go @@ -59,18 +59,12 @@ func recoveryError(code int, c *gin.Context) map[string]interface{} { func RecoveryHttpError(code int) gin.HandlerFunc { return func(c *gin.Context) { - defer func() { - if err := recover(); err != nil { - info := recoveryError(code, c) - if strings.HasPrefix(c.Request.URL.Path, "/api") { - c.JSON(code, gin.H(info)) - } else { - c.HTML(code, "page_404.html", template.Context(info)) - } - c.Abort() - } - }() - c.Next() + info := recoveryError(code, c) + if strings.HasPrefix(c.Request.URL.Path, "/api") { + c.JSON(code, gin.H(info)) + } else { + c.HTML(code, "page_404.html", template.Context(info)) + } } } func RecoveryJSON() gin.HandlerFunc {