CHAPTER 25

image

Error Handling

In this chapter, I complete my description of the Web API dispatch process by showing how errors are handled. I’ll show you the different ways you can deal with problems that you anticipate during development and what happens when unexpected problems arise. I explain how to control the response that is sent to the client and how to manage and log unhandled exceptions for the entire application. Table 25-1 summarizes this chapter.

Table 25-1. Chapter Summary

Problem

Solution

Listing

Trigger the default error handling policy.

Throw an exception from an action method or filter.

1–3

Throw an exception that generates a specific ...

Get Expert ASP.NET Web API 2 for MVC Developers 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.