AXTHORM

© AXTHORM

Developer library

Diagnose HTTP errors

Give clients a stable error type and a request ID they can quote to support. Keep credentials, private records and stack traces out of responses.

Walkthrough

1. Fix before retrying

Correct invalid input and resolve permission failures before trying again.

2. Retry transient faults carefully

Respect Retry-After when present. Use bounded exponential backoff with jitter and retry writes only when they are replay-safe.

3. Trace the request

Use the request ID in structured logs and look for the first failing dependency.

Worked example

A 409 tells the client the submitted operation conflicts with current state. In this inventory example, show fresh availability before asking the customer to try again.

HTTP status codes and what to do next
CodeMeaningNext step
400Malformed requestCheck the body and content type.
401Missing or invalid credentialsAuthenticate again; do not retry unchanged.
403Access deniedCheck role, scope and ownership.
404Resource not foundCheck the route or identifier.
405Method not allowedCheck the Allow header and use a supported method.
409State conflictRefresh state and review the conflicting operation.
415Unsupported media typeSend a supported Content-Type.
422Content cannot be processedCorrect the invalid fields.
429Too many requestsSlow down and honor Retry-After when provided.
500Unexpected server failureRecord the request ID; retry only if safe.
502Bad gatewayCheck the upstream dependency.
503Temporarily unavailableCheck service health and honor Retry-After if supplied.
504Gateway timeoutReconcile the result before replaying a write.
JSON · application/problem+json
{
  "type": "https://example.com/problems/out-of-stock",
  "title": "Item unavailable",
  "status": 409,
  "detail": "The requested quantity is no longer available.",
  "requestId": "req_demo_123"
}
Show another code example
JavaScript · error handling
if (response.status === 409) {
  await refreshAvailability();
  showMessage("Stock changed. Review the updated quantity.");
}

Reference: RFC 9457: Problem Details for HTTP APIs.

Try it yourself

Your API returns 422 for a missing field. What should the client do?