MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / classifyHTTPClientError

Function classifyHTTPClientError

lib/email/chime/client.go:283–294  ·  view source on GitHub ↗
(statusCode int, bodyStr string)

Source from the content-addressed store, hash-verified

281}
282
283func 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
296func classifyChimeOutcome(ctx context.Context, externalID string, responseBody NotifyTargetSyncResponse) error {
297 outcome := responseBody.Details.Outcome

Callers 1

handleResponseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected