HTTPStatus is the HTTP status a request error carries, or 0 when the request got no answer at all (the server was unreachable) or the error did not come from an HTTP answer.
(err error)
| 3553 | // request got no answer at all (the server was unreachable) or the error did |
| 3554 | // not come from an HTTP answer. |
| 3555 | func HTTPStatus(err error) int { |
| 3556 | var apiErr *APIError |
| 3557 | if errors.As(err, &apiErr) { |
| 3558 | return apiErr.Status |
| 3559 | } |
| 3560 | var statusErr *StatusError |
| 3561 | if errors.As(err, &statusErr) { |
| 3562 | return statusErr.Status |
| 3563 | } |
| 3564 | return 0 |
| 3565 | } |
| 3566 | |
| 3567 | // --- Item reminders (IDEA-2641) --- |
| 3568 |