Handling Exceptional Conditions with Grace and Elegance
summary
Argues for concrete rules: avoid returning nulls, prefer either Special Case (Null Object) singletons or thrown exceptions; define focused custom exception types, expose context (e.g. username) via named constructors, and wrap low-level exceptions so callers don’t learn implementation details. Shows a PHP error-handling system built with Whoops, a factory of handlers, marker interfaces for logging and HTTP-status mapping, and prefers try/catch in tests over PHPUnit’s expectException for clearer arrange/act/assert structure.
AI-written summary · about
chapters (8)
- 0:00Start
- 1:28HAPPY PATH
- 12:12EXCEPTION VS SPECIAL CASE
- 15:08CREATING EXCEPTION CLASSES
- 16:38COMPONENT LEVEL EXCEPTION TYPE
- 18:07FORMATTING EXCEPTION MESSAGES
- 23:13RETROSPECT 1. create custom, cohesive Exception types
- 32:06TESTING EXCEPTIONS WITH PHPUNIT
related talks
38mLeveraging Typed Exceptions for Cleaner Error Handling
51mLeveraging Typed Exceptions for Cleaner Error Handling
51mExceptions in PHP: more complicated than it appears
42mLeveraging Typed Exceptions for Cleaner Error Handling
31mException design - the art of making debugging more accurate
30mThe World of Laravel Exceptions
44mModern PHP Standards and Community
58mObjects, Testing and Responsibility
