(status int, body string)
| 78 | } |
| 79 | |
| 80 | func newResponseStatusError(status int, body string) error { |
| 81 | var msg string |
| 82 | |
| 83 | if len(body) > 0 { |
| 84 | msg = fmt.Sprintf("status: %d; %s", status, body) |
| 85 | } else { |
| 86 | msg = fmt.Sprintf("status: %d", status) |
| 87 | } |
| 88 | |
| 89 | statusCode := 404 |
| 90 | if status >= 400 && status < 500 { |
| 91 | statusCode = status |
| 92 | } else if status >= 500 { |
| 93 | statusCode = http.StatusBadGateway |
| 94 | } |
| 95 | |
| 96 | return ResponseStatusError{errctx.NewTextError( |
| 97 | msg, |
| 98 | 1, |
| 99 | errctx.WithStatusCode(statusCode), |
| 100 | errctx.WithPublicMessage(msgSourceIsUnreachable), |
| 101 | errctx.WithShouldReport(false), |
| 102 | )} |
| 103 | } |
| 104 | |
| 105 | func newTooManyRedirectsError(n int) error { |
| 106 | return TooManyRedirectsError{errctx.NewTextError( |
no test coverage detected