Also called: exception, raise, finally, traceback
In plain English
Catch the specific error you expect, not every error.
Example
Rows with broken JSON are caught by try/except and skipped with a warning.
In code
try:
data = json.loads(raw)
except json.JSONDecodeError as e:
log.warning("Bad JSON: %s", e)
data = {}
finally:
f.close()
Related terms
Added 2026-11-30 · Last reviewed 2026-11-30