Validation & error handling
How to fail well — exception handling, logging and validation strategies for APIs.
- Exception handling in C# — fewer try/catch blocks, better errorsSwallowed exceptions, `throw ex`, catch blocks that only rethrow and a try/catch around every method. The habits that make failures hard to find, and a setup where you throw a meaningful exception and one central handler does the rest.
- Logging exceptions properly — once, structured, with contextThe same exception logged three times, a message without a stack trace and no way to find the request it belonged to. How to log exceptions so the person on support duty can actually use the logs, with structured logging, scopes and correlation IDs.
Planned posts
- Attribute validation vs. FluentValidation