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) UpdateOrganization() {
panic(err)
}
c.Data["json"] = object.UpdateOrganization(id, &organization)
c.Data["json"] = wrapActionResponse(object.UpdateOrganization(id, &organization))
c.ServeJSON()
}
@ -54,7 +54,7 @@ func (c *ApiController) AddOrganization() {
panic(err)
}
c.Data["json"] = object.AddOrganization(&organization)
c.Data["json"] = wrapActionResponse(object.AddOrganization(&organization))
c.ServeJSON()
}
@ -65,6 +65,6 @@ func (c *ApiController) DeleteOrganization() {
panic(err)
}
c.Data["json"] = object.DeleteOrganization(&organization)
c.Data["json"] = wrapActionResponse(object.DeleteOrganization(&organization))
c.ServeJSON()
}