Browse Source

Updated built-in exceptions diagram

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

40
README.md

@ -1366,27 +1366,27 @@ except <exception>:
``` ```
### Common Built-in Exceptions ### Common Built-in Exceptions
```python ```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.
└── 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

40
index.html

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