Topic
Error Handling
Treating failure as a designed path: validation at boundaries, exception translation, and what a caught exception obliges you to do.
5 pages
Writing17 January 2021
Always Use the "as" Operator? No Thank You!
Use a cast instead of `as` when the type is expected, so a mismatch raises InvalidCastException. Use `is` when the type genuinely varies and keep only guards backed by a real case.
Writing20 December 2020
Validating Formal Arguments? No Thank You!
Validate and clean data at the front and back doors; skip checks on internal formal arguments. Immutable DTOs preserve trust, one exception reports all errors, and black box tests exercise the doors.
Writing11 August 2019
The Configuration Provider: An Abstraction With Roles and Responsibilities
A Configuration Provider hides the source, returns typed settings, validates required values, and reports useful errors. Composed providers let each system select its settings.
Chapter20 September 2017
Validation and Exception Handling in C#
Where validation belongs and where it does not, exception design that fails fast and visibly, message quality, and logging that preserves the failure.
Chapter20 September 2017
Validation and Exception Handling in Python
Lock the front door and the back doors, fail fast and visibly, exception messages that carry diagnostic context, and a logging policy that does not swallow failure.