On Sat, May 29, 2021 at 4:54 PM Irit Katriel <[email protected]> wrote:
>
> You can control what the traceback of exceptions you are emitting:
>
> "raise e.with_traceback(None)" should clear everything before the current
> frame.
>
I'm sorry, but I still don't see how. This particular line would still show
up.
Traceback (most recent call last):
File "test.py", line 2, in <module>
d = date(2021, 13, 1)
File "C:\Users\andre\local_datetime.py", line 852, in __new__
raise e.with_traceback(None)
ValueError: ('month must be in 1..12', 13)
Sorry if I am missing something obvious. In the example I gave, as a user
calling date() [from a library], I would only want to see that line show up.
>
>
> Or you can get clever and construct a traceback with only the frames you
> want.
>
>
> On Saturday, May 29, 2021, 08:27:18 PM GMT+1, André Roberge <
> [email protected]> wrote:
>
> What I am interested in is having a project-agnostic standardised Python
> way to specify what to show to an end-user when an exception is raised.
>
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/EUDM54E3PDCYW4COZANAL7CQ77WMT2MS/
Code of Conduct: http://python.org/psf/codeofconduct/