[Tutor] How to raise error without the stack trace
hugo.yoshi at gmail.com
Sat Nov 26 12:14:22 CET 2011
On Sat, Nov 26, 2011 at 11:16 AM, Karim <kliateni at gmail.com> wrote:
> I want to fire my own exception without having the (useful but ugly in my
> case) stack trace display.
> How to modify a Exception type class for that purpose which looks like:
> classs MyError(Exception):
The stack trace is what happens when an exception is uncaught. You
don't need to modify it. What you want to do is catch the exception,
print it, then, depending on whether you can recover from the error,
possibly do a sys.exit(-1).
More information about the Tutor