Browse Source

Exceptions

pull/140/head
Jure Šorn 2 years ago
parent
commit
8431ea7ca4
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -1407,7 +1407,7 @@ except (<exception>, [...]) as <name>: ...
* **Also catches subclasses of the exception.** * **Also catches subclasses of the exception.**
* **Use `'traceback.print_exc()'` to print the error message to stderr.** * **Use `'traceback.print_exc()'` to print the error message to stderr.**
* **Use `'print(<name>)'` to print just the cause of the exception (its arguments).** * **Use `'print(<name>)'` to print just the cause of the exception (its arguments).**
* **Use `'logging.exception(<message>)'` to log the exception.**
* **Use `'logging.exception(<message>)'` to log the passed message, followed by the full error message of the caught exception.**
### Raising Exceptions ### Raising Exceptions
```python ```python

2
index.html

@ -1209,7 +1209,7 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
<li><strong>Also catches subclasses of the exception.</strong></li> <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 error message to stderr.</strong></li> <li><strong>Use <code class="python hljs"><span class="hljs-string">'traceback.print_exc()'</span></code> to print the error message to stderr.</strong></li>
<li><strong>Use <code class="python hljs"><span class="hljs-string">'print(&lt;name&gt;)'</span></code> to print just the cause of the exception (its arguments).</strong></li> <li><strong>Use <code class="python hljs"><span class="hljs-string">'print(&lt;name&gt;)'</span></code> to print just the cause of the exception (its arguments).</strong></li>
<li><strong>Use <code class="python hljs"><span class="hljs-string">'logging.exception(&lt;message&gt;)'</span></code> to log the exception.</strong></li>
<li><strong>Use <code class="python hljs"><span class="hljs-string">'logging.exception(&lt;message&gt;)'</span></code> to log the passed message, followed by the full error message of the caught exception.</strong></li>
</ul> </ul>
<div><h3 id="raisingexceptions">Raising Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> &lt;exception&gt; <div><h3 id="raisingexceptions">Raising Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> &lt;exception&gt;
<span class="hljs-keyword">raise</span> &lt;exception&gt;() <span class="hljs-keyword">raise</span> &lt;exception&gt;()

Loading…
Cancel
Save