ApiOutputAbort writes the HTTP response code header and saves the error internally, but doesn't push it to the response
(c *gin.Context, err error)
| 121 | |
| 122 | // ApiOutputAbort writes the HTTP response code header and saves the error internally, but doesn't push it to the response |
| 123 | func ApiOutputAbort(c *gin.Context, err error) { |
| 124 | if e, ok := err.(errors.Error); ok { |
| 125 | logruslog.Global.Error(err, "HTTP %d abort-error", e.GetType().GetHttpCode()) |
| 126 | _ = c.AbortWithError(e.GetType().GetHttpCode(), errors.Default.New(e.Messages().Format())) |
| 127 | } else { |
| 128 | logruslog.Global.Error(err, "HTTP %d abort-error (native)", http.StatusInternalServerError) |
| 129 | _ = c.AbortWithError(http.StatusInternalServerError, err) |
| 130 | } |
| 131 | } |