Improve API error handling.

This commit is contained in:
Yang Luo
2021-03-28 00:48:34 +08:00
parent 6c2c5be33d
commit d6715c7601
18 changed files with 54 additions and 69 deletions

View File

@ -48,7 +48,7 @@ func (c *ApiController) UpdateUser() {
panic(err)
}
c.Data["json"] = object.UpdateUser(id, &user)
c.Data["json"] = wrapActionResponse(object.UpdateUser(id, &user))
c.ServeJSON()
}
@ -59,7 +59,7 @@ func (c *ApiController) AddUser() {
panic(err)
}
c.Data["json"] = object.AddUser(&user)
c.Data["json"] = wrapActionResponse(object.AddUser(&user))
c.ServeJSON()
}
@ -70,6 +70,6 @@ func (c *ApiController) DeleteUser() {
panic(err)
}
c.Data["json"] = object.DeleteUser(&user)
c.Data["json"] = wrapActionResponse(object.DeleteUser(&user))
c.ServeJSON()
}