Skip to content

Commit

Permalink
Update validator.go
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgao authored Oct 13, 2017
1 parent 8b1fb23 commit e8d33c0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ func ValidateJson(in []byte, v interface{}) error {
return nil
}

//注意 最大值最小值的校验当应用在update动作时候,可能会导致json umarshal时候给了默认值0 返回错误 -gs
func ValidateParameters(in interface{}) (err error) {
defer func() { // 必须要先声明defer,否则不能捕获到panic异常
defer func() {
if err := recover(); err != nil {
fmt.Println(err) // 这里的err其实就是panic传入的内容,55
fmt.Println(err)
}
}()
//Indirect returns the value that v points to. If v is a nil pointer,
Expand Down

0 comments on commit e8d33c0

Please sign in to comment.