Browse Source

Exceptions

pull/46/head
Jure Šorn 5 years ago
parent
commit
f42080c075
3 changed files with 15 additions and 15 deletions
  1. 16
      README.md
  2. 12
      index.html
  3. 2
      web/script_2.js

16
README.md

@ -1384,13 +1384,6 @@ raise <exception>(<el>)
raise <exception>(<el>, ...) raise <exception>(<el>, ...)
``` ```
#### Useful built-in exceptions:
```python
raise ValueError('Argument is of right type but inappropriate value!')
raise TypeError('Argument is of wrong type!')
raise RuntimeError('None of above!')
```
#### Re-raising caught exception: #### Re-raising caught exception:
```python ```python
except <exception>: except <exception>:
@ -1398,11 +1391,18 @@ except <exception>:
raise raise
``` ```
#### Useful built-in exceptions:
```python
raise ValueError('Argument is of right type but inappropriate value!')
raise TypeError('Argument is of wrong type!')
raise RuntimeError('None of above!')
```
### Common Built-in Exceptions ### Common Built-in Exceptions
```text ```text
BaseException BaseException
+-- SystemExit # Raised by the sys.exit() function. +-- SystemExit # Raised by the sys.exit() function.
+-- KeyboardInterrupt # Raised when the user hits the interrupt key.
+-- KeyboardInterrupt # Raised when the user hits the interrupt key (ctrl-c).
+-- Exception # User-defined exceptions should be derived from this class. +-- Exception # User-defined exceptions should be derived from this class.
+-- StopIteration # Raised by next() when run on an empty iterator. +-- StopIteration # Raised by next() when run on an empty iterator.
+-- ArithmeticError # Base class for arithmetic errors. +-- ArithmeticError # Base class for arithmetic errors.

12
index.html

@ -1297,19 +1297,19 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
<span class="hljs-keyword">raise</span> &lt;exception&gt;(&lt;el&gt;, ...) <span class="hljs-keyword">raise</span> &lt;exception&gt;(&lt;el&gt;, ...)
</code></pre></div> </code></pre></div>
<div><h4 id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">'Argument is of right type but inappropriate value!'</span>)
<span class="hljs-keyword">raise</span> TypeError(<span class="hljs-string">'Argument is of wrong type!'</span>)
<span class="hljs-keyword">raise</span> RuntimeError(<span class="hljs-string">'None of above!'</span>)
</code></pre></div>
<div><h4 id="reraisingcaughtexception">Re-raising caught exception:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;: <div><h4 id="reraisingcaughtexception">Re-raising caught exception:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;:
&lt;code&gt; &lt;code&gt;
<span class="hljs-keyword">raise</span> <span class="hljs-keyword">raise</span>
</code></pre></div> </code></pre></div>
<div><h4 id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">'Argument is of right type but inappropriate value!'</span>)
<span class="hljs-keyword">raise</span> TypeError(<span class="hljs-string">'Argument is of wrong type!'</span>)
<span class="hljs-keyword">raise</span> RuntimeError(<span class="hljs-string">'None of above!'</span>)
</code></pre></div>
<div><h3 id="commonbuiltinexceptions">Common Built-in Exceptions</h3><pre><code class="text language-text">BaseException <div><h3 id="commonbuiltinexceptions">Common Built-in Exceptions</h3><pre><code class="text language-text">BaseException
+-- SystemExit # Raised by the sys.exit() function. +-- SystemExit # Raised by the sys.exit() function.
+-- KeyboardInterrupt # Raised when the user hits the interrupt key.
+-- KeyboardInterrupt # Raised when the user hits the interrupt key (ctrl-c).
+-- Exception # User-defined exceptions should be derived from this class. +-- Exception # User-defined exceptions should be derived from this class.
+-- StopIteration # Raised by next() when run on an empty iterator. +-- StopIteration # Raised by next() when run on an empty iterator.
+-- ArithmeticError # Base class for arithmetic errors. +-- ArithmeticError # Base class for arithmetic errors.

2
web/script_2.js

@ -125,7 +125,7 @@ const DIAGRAM_8_A =
const DIAGRAM_8_B = const DIAGRAM_8_B =
"BaseException\n" + "BaseException\n" +
" ├── SystemExit <span class='hljs-comment'># Raised by the sys.exit() function.</span>\n" + " ├── SystemExit <span class='hljs-comment'># Raised by the sys.exit() function.</span>\n" +
" ├── KeyboardInterrupt <span class='hljs-comment'># Raised when the user hits the interrupt key.</span>\n" +
" ├── KeyboardInterrupt <span class='hljs-comment'># Raised when the user hits the interrupt key (ctrl-c).</span>\n" +
" └── Exception <span class='hljs-comment'># User-defined exceptions should be derived from this class.</span>\n" + " └── Exception <span class='hljs-comment'># User-defined exceptions should be derived from this class.</span>\n" +
" ├── StopIteration <span class='hljs-comment'># Raised by next() when run on an empty iterator.</span>\n" + " ├── StopIteration <span class='hljs-comment'># Raised by next() when run on an empty iterator.</span>\n" +
" ├── ArithmeticError <span class='hljs-comment'># Base class for arithmetic errors.</span>\n" + " ├── ArithmeticError <span class='hljs-comment'># Base class for arithmetic errors.</span>\n" +

Loading…
Cancel
Save