-
Book Overview & Buying
-
Table Of Contents
ASP.NET Core MVC 2.0 Cookbook
By :
In this recipe, you will learn how to manage exceptions with Web API.
Usually, we don't want to lose the cause of an exception. So, we should persist and maintain all the exception's logs. Exception logs can be huge in terms of storage capacity needed to persist them.
We can log all the exceptions in files, or a database table (such as MSSQL, Oracle, or MySql), or document stores (such as MongoDb (https://www.mongodb.com/), or Azure CosmosDb (https://azure.microsoft.com/en-us/services/cosmos-db/)).
The logged exception would contain at least:
We generally send only the descriptive message to the client, and log other information about the exception.
With Web API 2, before ASP.NET Core, the HttpError class sent a structured error to the client.
HttpError was traditionally used by Web API to serve up error information to the client in a (kind of) standardized way. It had some interesting properties...
Change the font size
Change margin width
Change background colour