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

@ -43,7 +43,7 @@ func (c *ApiController) UpdateToken() {
panic(err)
}
c.Data["json"] = object.UpdateToken(id, &token)
c.Data["json"] = wrapActionResponse(object.UpdateToken(id, &token))
c.ServeJSON()
}
@ -54,7 +54,7 @@ func (c *ApiController) AddToken() {
panic(err)
}
c.Data["json"] = object.AddToken(&token)
c.Data["json"] = wrapActionResponse(object.AddToken(&token))
c.ServeJSON()
}
@ -65,7 +65,7 @@ func (c *ApiController) DeleteToken() {
panic(err)
}
c.Data["json"] = object.DeleteToken(&token)
c.Data["json"] = wrapActionResponse(object.DeleteToken(&token))
c.ServeJSON()
}