Skip to content

Commit

Permalink
We do not longer have to call JSON() explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jun 13, 2015
1 parent 352868e commit d6425f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit d6425f1

Please sign in to comment.