the.bay.news

Exceptions some time can be lost

Discussions on Python.org
Exceptions some time can be lost
Main problem: exceptions some time can be lost. Assume E1 and E2 are two completely unrelated exceptions. (For example E1 is FileNotFoundError and E2 is AttributeError) class E1(Exception): pass class E2(Exception): pass def raise_double_error(): try: raise E1(1) except E1: raise E2(2) def main1(): try: raise_double_error() except E2 as e: pass # comletely handle E2 but not E1 main1() # E1 lost Let’s try to fix it: (already I need some extra code) def main2(): try: raise...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.