Browse Source

Updated built-in exceptions diagram

pull/36/head
Jure Šorn 5 years ago
parent
commit
a927bfaffa
2 changed files with 38 additions and 38 deletions
  1. 38
      README.md
  2. 38
      index.html

38
README.md

@ -1368,25 +1368,25 @@ except <exception>:
### Common Built-in Exceptions ### Common Built-in Exceptions
```python ```python
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.
+-- 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.
| +-- ZeroDivisionError # Raised when dividing by zero. │ └── ZeroDivisionError # Raised when dividing by zero.
+-- AttributeError # Raised when an attribute is missing. ├── AttributeError # Raised when an attribute is missing.
+-- EOFError # Raised by input() when it hits end-of-file condition. ├── EOFError # Raised by input() when it hits end-of-file condition.
+-- LookupError # Raised when a look-up on sequence or dict fails. ├── LookupError # Raised when a look-up on sequence or dict fails.
| +-- IndexError # Raised when a sequence index is out of range. │ ├── IndexError # Raised when a sequence index is out of range.
| +-- KeyError # Raised when a dictionary key is not found. │ └── KeyError # Raised when a dictionary key is not found.
+-- NameError # Raised when a variable name is not found. ├── NameError # Raised when a variable name is not found.
+-- OSError # Failures such as “file not found” or “disk full”. ├── OSError # Failures such as “file not found” or “disk full”.
| +-- FileNotFoundError # When a file or directory is requested but doesn't exist. │ └── FileNotFoundError # When a file or directory is requested but doesn't exist.
+-- RuntimeError # Raised by errors that don't fall in other categories. ├── RuntimeError # Raised by errors that don't fall in other categories.
| +-- RecursionError # Raised when the the maximum recursion depth is exceeded. │ └── RecursionError # Raised when the the maximum recursion depth is exceeded.
+-- TypeError # Raised when an argument is of wrong type. ├── TypeError # Raised when an argument is of wrong type.
+-- ValueError # When an argument is of right type but inappropriate value. └── ValueError # When an argument is of right type but inappropriate value.
+-- UnicodeError # Raised when encoding/decoding strings from/to bytes fails. └── UnicodeError # Raised when encoding/decoding strings from/to bytes fails.
``` ```
### User-defined Exceptions ### User-defined Exceptions

38
index.html

@ -1259,25 +1259,25 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
</code></pre> </code></pre>
<h3 id="commonbuiltinexceptions">Common Built-in Exceptions</h3> <h3 id="commonbuiltinexceptions">Common Built-in Exceptions</h3>
<pre><code class="python language-python hljs">BaseException <pre><code class="python language-python hljs">BaseException
+-- SystemExit <span class="hljs-comment"># Raised by the sys.exit() function.</span> ├── SystemExit <span class="hljs-comment"># Raised by the sys.exit() function.</span>
+-- KeyboardInterrupt <span class="hljs-comment"># Raised when the user hits the interrupt key.</span> ├── KeyboardInterrupt <span class="hljs-comment"># Raised when the user hits the interrupt key.</span>
+-- Exception <span class="hljs-comment"># User-defined exceptions should be derived from this class.</span> └── Exception <span class="hljs-comment"># User-defined exceptions should be derived from this class.</span>
+-- StopIteration <span class="hljs-comment"># Raised by next() when run on an empty iterator.</span> ├── StopIteration <span class="hljs-comment"># Raised by next() when run on an empty iterator.</span>
+-- ArithmeticError <span class="hljs-comment"># Base class for arithmetic errors.</span> ├── ArithmeticError <span class="hljs-comment"># Base class for arithmetic errors.</span>
| +-- ZeroDivisionError <span class="hljs-comment"># Raised when dividing by zero.</span> │ └── ZeroDivisionError <span class="hljs-comment"># Raised when dividing by zero.</span>
+-- AttributeError <span class="hljs-comment"># Raised when an attribute is missing.</span> ├── AttributeError <span class="hljs-comment"># Raised when an attribute is missing.</span>
+-- EOFError <span class="hljs-comment"># Raised by input() when it hits end-of-file condition.</span> ├── EOFError <span class="hljs-comment"># Raised by input() when it hits end-of-file condition.</span>
+-- LookupError <span class="hljs-comment"># Raised when a look-up on sequence or dict fails.</span> ├── LookupError <span class="hljs-comment"># Raised when a look-up on sequence or dict fails.</span>
| +-- IndexError <span class="hljs-comment"># Raised when a sequence index is out of range.</span> │ ├── IndexError <span class="hljs-comment"># Raised when a sequence index is out of range.</span>
| +-- KeyError <span class="hljs-comment"># Raised when a dictionary key is not found.</span> │ └── KeyError <span class="hljs-comment"># Raised when a dictionary key is not found.</span>
+-- NameError <span class="hljs-comment"># Raised when a variable name is not found.</span> ├── NameError <span class="hljs-comment"># Raised when a variable name is not found.</span>
+-- OSError <span class="hljs-comment"># Failures such as “file not found” or “disk full”.</span> ├── OSError <span class="hljs-comment"># Failures such as “file not found” or “disk full”.</span>
| +-- FileNotFoundError <span class="hljs-comment"># When a file or directory is requested but doesn't exist.</span> │ └── FileNotFoundError <span class="hljs-comment"># When a file or directory is requested but doesn't exist.</span>
+-- RuntimeError <span class="hljs-comment"># Raised by errors that don't fall in other categories.</span> ├── RuntimeError <span class="hljs-comment"># Raised by errors that don't fall in other categories.</span>
| +-- RecursionError <span class="hljs-comment"># Raised when the the maximum recursion depth is exceeded.</span> │ └── RecursionError <span class="hljs-comment"># Raised when the the maximum recursion depth is exceeded.</span>
+-- TypeError <span class="hljs-comment"># Raised when an argument is of wrong type.</span> ├── TypeError <span class="hljs-comment"># Raised when an argument is of wrong type.</span>
+-- ValueError <span class="hljs-comment"># When an argument is of right type but inappropriate value.</span> └── ValueError <span class="hljs-comment"># When an argument is of right type but inappropriate value.</span>
+-- UnicodeError <span class="hljs-comment"># Raised when encoding/decoding strings from/to bytes fails. </span> └── UnicodeError <span class="hljs-comment"># Raised when encoding/decoding strings from/to bytes fails.</span>
</code></pre> </code></pre>
<h3 id="userdefinedexceptions">User-defined Exceptions</h3> <h3 id="userdefinedexceptions">User-defined Exceptions</h3>
<pre><code class="python language-python hljs"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyError</span><span class="hljs-params">(Exception)</span>:</span> <pre><code class="python language-python hljs"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyError</span><span class="hljs-params">(Exception)</span>:</span>

|||||||
100:0
Loading…
Cancel
Save