Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43002>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to