Python Language Exceptions: Difference between revisions
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
=Overview= | =Overview= | ||
<code>try/except</code> is a language-level mechanism to handle errors (traceback) that may be caused by a section of the code. | <code>[[#try.2Fexcept|try/except]]</code> is a language-level mechanism to handle errors (traceback) that may be caused by a section of the code. | ||
To trigger an exception manually in the code use <code>[[#raise|raise]]</code>. | To trigger an exception manually in the code use <code>[[#raise|raise]]</code>. |
Revision as of 23:28, 20 January 2022
Internal
Overview
try/except
is a language-level mechanism to handle errors (traceback) that may be caused by a section of the code.
To trigger an exception manually in the code use raise
.
To conditionally trigger an exception in the code, use assert
.