Renames ErrorRender() to ErrorLogger()

This commit is contained in:
Manu Mtz-Almeida 2014-06-30 03:59:21 +02:00
parent 1565111274
commit 40dc444270
2 changed files with 12 additions and 11 deletions

View File

@ -5,6 +5,18 @@ import (
"time" "time"
) )
func ErrorLogger() HandlerFunc {
return func(c *Context) {
defer func() {
if len(c.Errors) > 0 {
log.Println(c.Errors)
c.JSON(-1, c.Errors)
}
}()
c.Next()
}
}
func Logger() HandlerFunc { func Logger() HandlerFunc {
return func(c *Context) { return func(c *Context) {

View File

@ -6,17 +6,6 @@ import (
"strings" "strings"
) )
func (c *Context) ErrorRender() HandlerFunc {
return func(c *Context) {
defer func() {
if len(c.Errors) > 0 {
c.JSON(-1, c.Errors)
}
}()
c.Next()
}
}
func Validate(c *Context, obj interface{}) error { func Validate(c *Context, obj interface{}) error {
var err error var err error