error handling — when ai's code crashes mid-flight7 / 9
catching the right error — not 'anything that goes wrong'
AI wrote two except clauses for parse_age. The intent: missing key
returns -1, bad string returns 0. But the classes got swapped — the
body raises ValueError for int("n/a"), but that branch returns -1
instead of 0.
Fix the two except lines so that calling parse_age({"age": "n/a"})
prints 0 (bad parse → 0).
The break is on lines 4, 6 — but read the whole snippet first.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _