Message385530
How do you "the wrong message" to implicitly chain exceptions rather
than explicitly?
The difference between:
try:
len(1)
except TypeError as e:
raise ValueError(msg) from e
and
try:
len(1)
except TypeError as e:
raise ValueError(msg)
is that the first traceback says:
"The above exception was the direct cause of the following exception"
and the second says:
"During handling of the above exception, another exception occurred"
Both messages are correct, but if the difference beween the two matters
to you, feel free to use whichever form you prefer. |
|
Date |
User |
Action |
Args |
2021-01-23 12:05:10 | steven.daprano | set | recipients:
+ steven.daprano, cool-RR |
2021-01-23 12:05:10 | steven.daprano | link | issue43002 messages |
2021-01-23 12:05:10 | steven.daprano | create | |
|