use json.Marshal provided with validation
This commit is contained in:
parent
cd7d44fcd8
commit
2d7f6be830
5 changed files with 40 additions and 56 deletions
|
|
@ -120,7 +120,7 @@ func (rs *AccountResource) create(w http.ResponseWriter, r *http.Request) {
|
|||
if err := rs.Store.Create(data.Account); err != nil {
|
||||
switch err.(type) {
|
||||
case validation.Errors:
|
||||
render.Render(w, r, ErrValidation(ErrAccountValidation, err))
|
||||
render.Render(w, r, ErrValidation(ErrAccountValidation, err.(validation.Errors)))
|
||||
return
|
||||
}
|
||||
render.Render(w, r, ErrInvalidRequest(err))
|
||||
|
|
@ -145,7 +145,7 @@ func (rs *AccountResource) update(w http.ResponseWriter, r *http.Request) {
|
|||
if err := rs.Store.Update(acc); err != nil {
|
||||
switch err.(type) {
|
||||
case validation.Errors:
|
||||
render.Render(w, r, ErrValidation(ErrAccountValidation, err))
|
||||
render.Render(w, r, ErrValidation(ErrAccountValidation, err.(validation.Errors)))
|
||||
return
|
||||
}
|
||||
render.Render(w, r, ErrInvalidRequest(err))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue