NotFoundOrError use error check function to determine if the error is about not found. It responses with 404 status code for not found error, or error context description for logging purpose of 500 server error.
(err error, msg string)
| 62 | // is about not found. It responses with 404 status code for not found error, |
| 63 | // or error context description for logging purpose of 500 server error. |
| 64 | func (c *APIContext) NotFoundOrError(err error, msg string) { |
| 65 | if errutil.IsNotFound(err) { |
| 66 | c.NotFound() |
| 67 | return |
| 68 | } |
| 69 | c.Error(err, msg) |
| 70 | } |
| 71 | |
| 72 | // SetLinkHeader sets pagination link header by given total number and page size. |
| 73 | func (c *APIContext) SetLinkHeader(total, pageSize int) { |
no test coverage detected