Skip to content
0:00 / 0:00

#asp.netcore#cleanarchitecture#domain-drivendesign

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

Amichai Mantinband

60K subscribers • 7 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Amichai Mantinband
  • May be out of date. The tools, versions or practices it shows have likely moved on.

Intermediate. Assumes working knowledge.

100K views4 years ago1 recommendation

Web developmentSoftware designSoftware architectureAPI design

Amichai Mantinband shows how to implement global error handling and custom exception middleware in an ASP.NET Core REST API.

Link to the full playlist: youtube.com/watch?v=fhM0V2N1GpY&list=PLzYkqgWkHPKBcDIP5gzLfA… Become a Patreon & get the source code: patreon.com/amantinband Follow me on 'em socials: Twitter: twitter.com/amantinband LinkedIn: linkedin.com/in/amantinband/ GitHub: 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 . Overview . Custom Error Handling Middleware . Custom Exception Filter Attribute . Problem Details Response RFC Specification . Problem Details Response from Error Handling Filter . UseExceptionHandler Middleware & Error Endpoint . Clone & Build ASP.NET Source Code . Deep Dive Into The Framework's Implementation . Implementing A Custom Problem Details Factory

Why it's here

1 person recommends this

What people say. Recommended as a go-to tutorial for implementing global exception handling middleware in .NET APIs.

u/_nikola-_-tesla_in r/dotnet • Recommends

On “When to use try catch ?”

Try this youtube tutorial by Amichai Mantinband Throw a custom exception with error details and create a global exception handling middleware that handles it. This is one of the most commonly used approach.

u/_nikola-_-tesla_in r/dotnet • Recommends

On “When to use try catch ?”

Try this youtube tutorial by Amichai Mantinband