Learn Everything

Paths/Backend Engineer/API Design / Errors & Versioning

Practice Taskintermediateubuntu:24.04Ask AI

Standardise the Error Envelope

Every endpoint fails eventually. Give them all one shape so a client can handle the failure with one code path.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • File ~/api/errors.md exists○
  • The document defines the fields every error carries○
  • The document lists the status codes the API uses○
  • The document includes the rate limit response○

02Walkthrough

1 of 3 revealed
  1. 01

    Write the envelope

    Every error body carries the same fields - status_code, code, message and request_id. The request id is what support asks for first.

    echo '# Error envelope\n\nEvery error response has the same shape:\n\n- status_code - the HTTP status\n- code - a stable machine readable string\n- message - a human readable sentence\n- request_id - correlates the error with the logs' > ~/api/errors.md
  2. 2 locked · each failed submit reveals one

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list