Global Error Handling | ASP.NET 6 REST API Following CLEAN ARCHITECTURE & DDD Tutorial | Part 4

Опубликовано: 29 Сентябрь 2024
на канале: Amichai Mantinband
91,360
2.2k

Link to the full playlist:    • ASP.NET 6 REST API Following CLEAN AR...  

Become a Patreon & get the source code:   / amantinband  

Follow me on 'em socials:
Twitter:   / amantinband  
LinkedIn:   / amantinband  
GitHub: https://github.com/amantinband

What is this series?
We'll build a REST API following Clean Architecture & Domain-Driven Design principles completely from scratch.
We will use .NET 6, EF Core, and common patterns such as CQRS, unit of work, repository, mediator, and more 💪🏽
We'll also use some awesome open-source libraries such as MediatR, FluentValidation, ErrorOr, Throw, Mapster, and more.
The developing environment will be visual studio code & dotnet CLI only. We will use awesome vscode plugins for everything from sending HTTP requests to connecting to our SQL database, debugging, and peeking at JWT tokens.
We will code and refactor multiple times to tackle the many concepts I want to teach. When the series will be over, you'll have a good understanding and intuition on how to use these patterns & libraries in your industry-level applications.

How often will a new part come out?
Once or twice a week.

What are we doing today?
We'll dive into Global Error Handling using the following approaches:
1. Error Handling Middleware
2. Exception Filter Attribute
3. UseExceptionHandler middleware & "error" endpoint

We'll learn about the Problem Details error model specification & how to use it in ASP.NET.
We'll even dive into the ASP.NET's source code & understand the magic behind the Problem method in the ControllerBase and then we'll create a custom ProblemDetailsFactory which will allow us to customize the problem details response.

#dotnet

00:00. Overview
02:05. Custom Error Handling Middleware
04:10. Custom Exception Filter Attribute
07:55. Problem Details Response RFC Specification
10:08. Problem Details Response from Error Handling Filter
12:10. UseExceptionHandler Middleware & Error Endpoint
15:55. Clone & Build ASP.NET Source Code
17:15. Deep Dive Into The Framework's Implementation
19:40. Implementing A Custom Problem Details Factory