Skip to content

Commit a97d71b

Browse files
committed
Exceptions
1 parent d6f55d9 commit a97d71b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ line = linecache.getline(filename, line_num)
13961396
error_msg = traceback.format_exc()
13971397
```
13981398

1399-
### Common Built-in Exceptions
1399+
### Built-in Exceptions
14001400
```text
14011401
BaseException
14021402
+-- SystemExit # Raised by the sys.exit() function.
@@ -1420,13 +1420,6 @@ BaseException
14201420
+-- UnicodeError # Raised when encoding/decoding strings from/to bytes fails.
14211421
```
14221422

1423-
#### Useful built-in exceptions:
1424-
```python
1425-
raise TypeError('Argument is of wrong type!')
1426-
raise ValueError('Argument is of right type but inappropriate value!')
1427-
raise RuntimeError('None of above!')
1428-
```
1429-
14301423
#### Collections and their exceptions:
14311424
```text
14321425
+-----------+------------+------------+------------+
@@ -1439,6 +1432,13 @@ raise RuntimeError('None of above!')
14391432
+-----------+------------+------------+------------+
14401433
```
14411434

1435+
#### Useful built-in exceptions:
1436+
```python
1437+
raise TypeError('Argument is of wrong type!')
1438+
raise ValueError('Argument is of right type but inappropriate value!')
1439+
raise RuntimeError('None of above!')
1440+
```
1441+
14421442
### User-defined Exceptions
14431443
```python
14441444
class MyError(Exception):

index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@
13101310
error_msg = traceback.format_exc()
13111311
</code></pre></div>
13121312

1313-
<div><h3 id="commonbuiltinexceptions">Common Built-in Exceptions</h3><pre><code class="text language-text">BaseException
1313+
<div><h3 id="builtinexceptions">Built-in Exceptions</h3><pre><code class="text language-text">BaseException
13141314
+-- SystemExit # Raised by the sys.exit() function.
13151315
+-- KeyboardInterrupt # Raised when the user hits the interrupt key (ctrl-c).
13161316
+-- Exception # User-defined exceptions should be derived from this class.
@@ -1332,11 +1332,6 @@
13321332
+-- UnicodeError # Raised when encoding/decoding strings from/to bytes fails.
13331333
</code></pre></div>
13341334

1335-
<div><h4 id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> TypeError(<span class="hljs-string">'Argument is of wrong type!'</span>)
1336-
<span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">'Argument is of right type but inappropriate value!'</span>)
1337-
<span class="hljs-keyword">raise</span> RuntimeError(<span class="hljs-string">'None of above!'</span>)
1338-
</code></pre></div>
1339-
13401335
<div><h4 id="collectionsandtheirexceptions">Collections and their exceptions:</h4><pre><code class="text language-text">+-----------+------------+------------+------------+
13411336
| | list | dict | set |
13421337
+-----------+------------+------------+------------+
@@ -1347,6 +1342,11 @@
13471342
+-----------+------------+------------+------------+
13481343
</code></pre></div>
13491344

1345+
<div><h4 id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> TypeError(<span class="hljs-string">'Argument is of wrong type!'</span>)
1346+
<span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">'Argument is of right type but inappropriate value!'</span>)
1347+
<span class="hljs-keyword">raise</span> RuntimeError(<span class="hljs-string">'None of above!'</span>)
1348+
</code></pre></div>
1349+
13501350
<div><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>
13511351
<span class="hljs-keyword">pass</span>
13521352

0 commit comments

Comments
 (0)