Skip to content
Ameen Abozaid
Planned lessonJNR-015-L01

Errors are part of the API

  • Lesson 1 of 6
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

treat error responses as a designed contract.

Planned topics

  • Clients depend on error responses as much as on success ones.
  • Use the right status: 400 bad input, 404 not found, 409 conflict, 422 or 400 for a broken business rule, 500 for our bug.
  • Never return 200 with "error": true: tools and clients read the status first.
  • One error shape for the whole API.
Draft outline details

Demonstration

a table: situation / status / meaning.

Check your understanding

A product id does not exist. Which status?

Show answer

404.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.