2021-06-03 09:05:38 +02:00
|
|
|
|
=== on 3 Mar 2020, 17:27:45 Nicolas Harraudeau wrote:
|
2021-06-02 20:44:38 +02:00
|
|
|
|
Note: There is no need to create issues for \``++raise++`` statements because:
|
|
|
|
|
|
|
|
|
|
* there might be a good reason to raise an exception (Ex: cannot release resource)
|
|
|
|
|
* python will link the new exception and the old exception automatically:
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
In [1]: try:
|
|
|
|
|
...: raise ValueError("try block")
|
|
|
|
|
...: finally:
|
|
|
|
|
...: raise TypeError("finally block")
|
|
|
|
|
...:
|
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
ValueError Traceback (most recent call last)
|
|
|
|
|
<ipython-input-1-dcce5abc58e4> in <module>
|
|
|
|
|
1 try:
|
|
|
|
|
----> 2 raise ValueError("try block")
|
|
|
|
|
3 finally:
|
|
|
|
|
|
|
|
|
|
ValueError: try block
|
|
|
|
|
|
|
|
|
|
During handling of the above exception, another exception occurred:
|
|
|
|
|
|
|
|
|
|
TypeError Traceback (most recent call last)
|
|
|
|
|
<ipython-input-1-dcce5abc58e4> in <module>
|
|
|
|
|
2 raise ValueError("try block")
|
|
|
|
|
3 finally:
|
|
|
|
|
----> 4 raise TypeError("finally block")
|
|
|
|
|
5
|
|
|
|
|
|
|
|
|
|
TypeError: finally block
|
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|