Error Handling & Structured Logging
Turn failures into consistent, safe API errors and emit structured, correlated logs that make incidents diagnosable.
3 objectives 5 steps about 100 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Map domain and infrastructure exceptions to HTTP responses in one place, returning Problem Details bodies without leaking stack traces or internal data.
- Handle failing dependencies with timeouts, bounded retries with backoff and jitter, and an explicit fallback or error.
- Emit structured JSON logs carrying a request ID across the request, outbound calls and background jobs, at suitable levels and without secrets or personal data.
Lesson plan
5 steps, about 100 min · 4 of 4 lessons available so far
- Expected Errors, Bugs and Outages Concept · 15 min
- One Place to Turn Exceptions into Responses Worked example · 25 min
- When the Database or an Upstream API Fails Concept · 20 min
- Lab: Structured Logs with Request IDs Lab · 25 min
- Check: Triage an Incident from the Logs Knowledge check · 6 questions
Practise it
Introduce a small exception hierarchy and global handlers that return Problem Details for 400, 404, 409, 422 and 500, wrap one outbound HTTP call in a timeout-and-retry policy, and switch to JSON logs whose request ID is echoed in an X-Request-ID response header; trace one failing request end to end.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own Web FrameworkIntermediate · 8–15 h
References
Hard prerequisites
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.