CHAPTER 5

image

Error Handling

In this chapter we will discuss:

  • Handling errors in a REST API
  • Designing meaningful error responses
  • Validating API inputs
  • Externalizing error messages

Error handling is one of the most important yet somewhat overlooked topics for programmers. Although we develop software with good intent, things do go wrong and we must be prepared to handle and communicate those errors gracefully. The communication aspect is especially important to developers consuming a REST API. Well-designed error responses allow consuming developers to understand the issues and help them to use the API correctly. Additionally, good error handling ...

Get Spring REST 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.