Handle Arbitrary Exception, Print Default Exception Message
Posted
by inspectorG4dget
on Stack Overflow
See other posts from Stack Overflow
or by inspectorG4dget
Published on 2010-01-05T11:29:03Z
Indexed on
2010/06/09
0:22 UTC
Read the original article
Hit count: 801
I have a program, a part of which executes a loop. During the execution of this loop, there are exceptions. Obviously, I would like my program to run without errors, but for the sake of progress, I would like the program to execute over the entire input and not stop when an exception is thrown. The easiest way to do this would be by implementing and except
block.
However, when I do this, it except
s all exceptions and continues with the program and I never get to see the exception message (which I need in order to debug).
Is there a way to except
any arbitrary exception and be able to print out the exception message in the except
block?
© Stack Overflow or respective owner