From d6425f1692d4aa170ece887b62bb75c9c4da5829 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Sat, 13 Jun 2015 16:42:12 +0200 Subject: [PATCH] We do not longer have to call JSON() explicitly --- logger.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/logger.go b/logger.go index e21a638e..e0f9b367 100644 --- a/logger.go +++ b/logger.go @@ -28,11 +28,11 @@ func ErrorLogger() HandlerFunc { func ErrorLoggerT(typ ErrorType) HandlerFunc { return func(c *Context) { c.Next() - + // avoid writting if we already wrote into the response body if !c.Writer.Written() { - json := c.Errors.ByType(typ).JSON() - if json != nil { - c.JSON(-1, json) + errors := c.Errors.ByType(typ) + if len(errors) > 0 { + c.JSON(-1, errors) } } }