Section: Exceptions

Raise custom error

python
python
raise ValueError("expected a positive integer")

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
Exception chaining
Exception chaining
OpenIn sheetpythonsame section
Basic try / except
Basic try / except
OpenIn sheetpythonsame section
Catch multiple exceptions
Catch multiple exceptions
OpenIn sheetpythonsame section
Else and finally
Else and finally
OpenIn sheetpythonsame section
Define custom exception
Define custom exception
OpenIn sheetpythonsame section
f-string interpolation
f-string interpolation