| 281 | } |
| 282 | |
| 283 | func classifyHTTPClientError(statusCode int, bodyStr string) error { |
| 284 | switch statusCode { |
| 285 | case http.StatusBadRequest: // 400 |
| 286 | return fmt.Errorf("%w: bad request (400): %s", ErrPermanentSystem, bodyStr) |
| 287 | case http.StatusUnauthorized: // 401 |
| 288 | return fmt.Errorf("%w: unauthorized (401): %s", ErrPermanentSystem, bodyStr) |
| 289 | case http.StatusForbidden: // 403 |
| 290 | return fmt.Errorf("%w: forbidden (403): %s", ErrPermanentSystem, bodyStr) |
| 291 | default: |
| 292 | return fmt.Errorf("%w: client error (%d): %s", ErrPermanentSystem, statusCode, bodyStr) |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | func classifyChimeOutcome(ctx context.Context, externalID string, responseBody NotifyTargetSyncResponse) error { |
| 297 | outcome := responseBody.Details.Outcome |