On Oct 23, 12:07 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
...
> if expert_mode:
> # experts get the full traceback with no hand-holding.
> raise
> else:
> # print a more friendly error message
...
Another approach is to always print a friendly error message,
but append the traceback to a log file (see the traceback
module for how to do that.) The friendly error message can
include a note that full information is available in the log
file.
The advantage of that is that you capture critical information
that is otherwise lost when a non-expert user hits the exception.
For intermittent bugs that are hard to reproduce, this can be
a lifesaver - especially when your favorite non-expert user
seems to have a knack for generating errors that you can't figure
out how to create ;-)
Alan
--
http://mail.python.org/mailman/listinfo/python-list