parent
a678eb4017
commit
ae17363f8b
12 changed files with 162 additions and 52 deletions
17
types/validation-error.go
Normal file
17
types/validation-error.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package types
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ValidationError map[string][]string
|
||||
|
||||
func (v ValidationError) Error() string {
|
||||
errs, err := json.Marshal(struct {
|
||||
ValidationError `json:"errors"`
|
||||
}{v})
|
||||
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
|
||||
return string(errs)
|
||||
}
|
Reference in a new issue