ServerError responds with a JSON-formatted error message. Example: ServerError(c, errors.New("internal server error"))
(c *gin.Context, err error)
| 35 | // |
| 36 | // ServerError(c, errors.New("internal server error")) |
| 37 | func ServerError(c *gin.Context, err error) { |
| 38 | c.PureJSON(http.StatusInternalServerError, R{ |
| 39 | Msg: err.Error(), |
| 40 | }) |
| 41 | } |
| 42 | |
| 43 | // UnauthorizedError responds with a JSON-formatted error message. |
| 44 | // |
no test coverage detected