promptdojo_

Raising errors — making your code fail loudly on purpose — step 7 of 9

Cursor wrote a function that catches an exception, logs it, and was supposed to re-raise so the caller still sees the failure. Instead it catches, logs, and silently returns None. The script then crashes later in a confusing place because a downstream call gets None.

Add a single line so that after the print on line 5, the same exception keeps propagating. The bare raise keyword (no class, no message) re-raises the exception that was just caught.

Expected output:

logging: invalid literal for int() with base 10: 'bad input'
caught at top: invalid literal for int() with base 10: 'bad input'
The break is on line 5 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.