~/talk

Handling Exceptional Conditions with Grace and Elegance

Talkat phpDay 2019 · 2019-05-10..05-11· [php, developer-experience]
speakerdeck:nikolaposa
slides:none on file

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

  1. 0:00Start
  2. 1:28HAPPY PATH
  3. 12:12EXCEPTION VS SPECIAL CASE
  4. 15:08CREATING EXCEPTION CLASSES
  5. 16:38COMPONENT LEVEL EXCEPTION TYPE
  6. 18:07FORMATTING EXCEPTION MESSAGES
  7. 23:13RETROSPECT 1. create custom, cohesive Exception types
  8. 32:06TESTING EXCEPTIONS WITH PHPUNIT
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.