On Sat, May 29, 2021 at 4:54 PM Irit Katriel email@example.com 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 < firstname.lastname@example.org> 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.