admin: Stop API response on error, don't try to display result
This commit is contained in:
parent
938c8c8556
commit
145ef4399f
|
@ -53,6 +53,7 @@ func DeclareRoutes(cfg *config.Options, router *gin.Engine) {
|
|||
func ApiResponse(c *gin.Context, data interface{}, err error) {
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue