Section: Exceptions

Catch multiple exceptions

python
python
try:
    data = json.loads(payload)
except (TypeError, ValueError) as exc:
    print(exc)

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Exceptions
Basic try / except
Basic try / except
OpenIn sheetpythonsame section
Else and finally
Else and finally
OpenIn sheetpythonsame section
Raise custom error
Raise custom error
OpenIn sheetpythonsame section
Exception chaining
Exception chaining
OpenIn sheetpythonsame section
Define custom exception
Define custom exception
OpenIn sheetpythonsame section
Read JSON from disk
Read JSON from disk
OpenIn sheetpython1 tag match