New JSON error facilities

This commit is contained in:
Manu Mtz-Almeida
2015-05-22 04:43:43 +02:00
parent b7205a6ec2
commit 71bd9f4500
2 changed files with 38 additions and 2 deletions

View File

@ -30,8 +30,9 @@ func ErrorLoggerT(typ int) HandlerFunc {
c.Next()
if !c.Writer.Written() {
if errs := c.Errors.ByType(typ); len(errs) > 0 {
c.JSON(-1, errs.Errors())
json := c.Errors.ByType(typ).JSON()
if json != nil {
c.JSON(-1, json)
}
}
}