default exception handler catching exceptions raising exceptions user-defined exceptions termination actions summary test your knowledgequiz test your knowledgeanswers exception coding details the try/except/else statement how try statements work try statement clauses the try else clause exampledefault behavior examplecatching built-in exceptions the try/finally statement examplecoding termination actions with try/finally unified try/except/finally unified try statement syntax combining finally and except by nesting unified try example the raise statement raising exceptions scopes and try except variables propagating exceptions with raise python exception chainingraise from the assert statement exampletrapping constraints (but not errors!with/as context managers basic usage the context management protocol multiple context managers in and later summary test your knowledgequiz test your knowledgeanswers exception objects exceptionsback to the future string exceptions are right outclass-based exceptions coding exceptions classes table of contents xxv