|
|
@ -1294,6 +1294,7 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st |
|
|
|
|
|
|
|
<ul> |
|
|
|
<li><strong>Also catches subclasses of the exception.</strong></li> |
|
|
|
<li><strong>Use <code class="python hljs"><span class="hljs-string">'traceback.print_exc()'</span></code> to print the the error message.</strong></li> |
|
|
|
</ul> |
|
|
|
<div><h3 id="raisingexceptions">Raising Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> <exception> |
|
|
|
<span class="hljs-keyword">raise</span> <exception>() |
|
|
@ -1306,11 +1307,11 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<div><h3 id="exceptionobject">Exception Object</h3><pre><code class="python language-python hljs">arguments = <name>.args |
|
|
|
line_number = <name>.__traceback__.tb_lineno |
|
|
|
func_name = <name>.__traceback__.tb_frame.f_code.co_name |
|
|
|
exc_type = <name>.__class__ |
|
|
|
filename = <name>.__traceback__.tb_frame.f_code.co_filename |
|
|
|
line = linecache.getline(filename, line_num) |
|
|
|
error_msg = traceback.format_exc() |
|
|
|
func_name = <name>.__traceback__.tb_frame.f_code.co_name |
|
|
|
line = linecache.getline(filename, <name>.__traceback__.tb_lineno) |
|
|
|
error_msg = traceback.format_exception(exc_type, <name>, <name>.__traceback__) |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<div><h3 id="builtinexceptions">Built-in Exceptions</h3><pre><code class="text language-text">BaseException |
|
|
|