ASP.NET Core: Exception Handling
1h 31mAdvanced2024-11-22
Authors

Ervis Trupja
Full-Stack .NET Web Developer with a mathematical background
Course details
When things go bad, good programmers are ready. Exception handling allows you to ensure your applications respond to errors with grace. With the right exception handling, your user’s experience will never be disrupted. This course teaches the basics of handling exceptions in the ASP.NET Core framework. Instructor Ervis Trupja starts with an overview of exception handling and then works through the various techniques to catch exceptions in ASP.NET. Learn how to use try-catch-finally to identify and handle errors, using both built-in and custom exception types. Then discover how to handle errors more efficiently with global handlers, and add exception filters to your .NET Core applications to apply global policies to unhandled exceptions.
Skills covered
ASP.NET CoreBack-End Web DevelopmentFull-Stack Web DevelopmentFront-End Web DevelopmentWeb DevelopmentMicrosoftOne-Off
Concepts
Introduction
- Why use exception handling
- What you should know
- ASP.NET Core updates
Getting Started with Exception Handling
- What is an exception and exception handling
- Why use exception handling
- Which are the common exception handling methods
Error Handling with Try-Catch Block
- Adding your first try-catch-finally block
- Common built-in exception types
- Create custom exception types
- Challenge - Create custom exception types
- Solution - Create custom exception types
- Using multiple catch blocks
Global Error Handling
- Why use global exception handlers
- Adding a new ErrorResponseData class
- Adding global built-in handler
- Updating Startup.cs and testing
- Adding global custom handler
- Challenge - Use custom exception handler
- Solution - Use custom exception handler
Working with Exception Filters
- Why use exception filters
- Adding an exception filter
- Testing the exception filter
Conclusion
- Continuing on with exception handling