18 Supporting the unhappy path: Error handling with problem+json
This chapter covers
- Finding and categorizing API errors
- The error-handling format from the OAS tools library
- The problem+json format
- Adding error responses to the PetSitter OpenAPI definition
As we have designed and implemented the PetSitter API, we’ve mostly looked at the happy path, which is when everything works according to plan and things are 200 OK. Obviously we want the interactions between our API and its users to be on this path as often as possible, but we cannot always guarantee that. In this chapter we’ll look at the ways things can go wrong and how to handle those situations.
The OpenAPI definition of an API is a contract that both sides, client and server, have to ...
Get Designing APIs with Swagger and OpenAPI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.