Skip to content

Commit

Permalink
Error middleware does not write if the it is already written
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Apr 7, 2015
1 parent 598c782 commit dcdf7b9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ func ErrorLoggerT(typ uint32) HandlerFunc {
return func(c *Context) {
c.Next()

errs := c.Errors.ByType(typ)
if len(errs) > 0 {
// -1 status code = do not change current one
c.JSON(-1, c.Errors)
if !c.Writer.Written() {
errs := c.Errors.ByType(typ)
if len(errs) > 0 {
c.JSON(-1, c.Errors)
}
}
}
}
Expand Down

0 comments on commit dcdf7b9

Please sign in to comment.