Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Exceptions in C# Async: AggregateException and Errors in WhenAll
An exception in an async method goes into the task and is thrown with its original type at the await. Throwing parameter checks at the call, the difference between Wait, GetResult and await, reaching every error and partial results from WhenAll, an error order that differs between two overloads, AggregateException.Handle and unobserved task exceptions.
Exception Handling in C#: try/catch/finally, throw and Your Own Exception
Exception handling in C#: try, catch and their order, cleanup with finally and using, how throw and throw ex differ in the stack trace, the when filter, writing your own exception type and using InnerException, and when to use an exception and when TryXxx.
Global Error Handling in ASP.NET Core: Exception Middleware and ProblemDetails
Starting from the real response of an unhandled exception on .NET 6, we move to UseExceptionHandler with an error controller, then to our own middleware that maps domain exceptions to 404/409/500 ProblemDetails.
Error Handling in TypeScript: unknown in catch, Narrowing Errors and the Result Pattern
We look at why the catch variable is unknown, narrowing with instanceof Error, custom error classes, Promise pitfalls, and modeling errors with Result and discriminated unions.