Global Exception Handling in ASP.NET Core Web API

April 20, 2020
 531
Global Exception Handling in ASP.NET Core Web API
A good web API is consistent and follows established patterns for communicating error states to the client, leveraging the appropriate HTTP status codes. To that end, a global exception handler can be very helpful in consolidating a service’s error handling logic in one place and translating errors into the appropriate responses to send back to the caller. In this post I’ll show you how you can plug your custom exception-handling logic into the ASP.NET Core request pipeline to handle any exceptions that are thrown in your service.

Hot Vacancies

DevOps Engineer

Private company, Azure

Our team is urgently looking for a DevOps Engineer for a direct 6-month contract. The client is based in the Netherlands, and the domain is healthcare. The primary task is to assist with the migration from a local data center to Azure.

.NET Developer

American startup, .NET

A developer is needed for an American startup that manages the operation and maintenance of residential complexes. This is a new project from scratch with a temporary integration of the old system (Web Forms, no code access).

.NET Backend Developer

Field Complete, .NET

Field Complete is a team of passionate, young & fun-loving professionals looking to change the uneffective way that Servicing Industry works on US markets. Field Complete is growing really fast. We are looking for a Back End Developer to build a top-level modern API, ready for high load. Strong expertise with:

Senior Xamarin Developer

DraftKings, Mobile

You will join a mobile team which is working on two very exciting projects, Sportsbook and Casino. The apps are used by users in the US, where we are working on the regulated markets. We are releasing apps every two weeks. Our apps are generating almost 75% of the company revenue and the user base is growing daily. Technical stack on the project: Xamarin.Forms, MVVM with DI, NewRelic, Azure + App Center etc. Switching to .Net MAUI in the nearest 2-3 months.

Senior .NET Engineer

DraftKings, .NET

You will be working in a large US-oriented company that puts as a priority: security, performance, and stability. The candidate will work on pushing a huge number of changes (several thousand per sec) to several thousand clients in a near real-time manner.