[Tutor] Error handling in functions / main program

Kent Johnson kent_johnson at skillsoft.com
Thu Aug 12 17:57:18 CEST 2004


Yes, you want to be careful not to hide too much. When a user gets an 
unexpected error you will want the stack trace. If all you get is a general 
error message you don't have much to work with.

There was a good example of this on the list recently where the main 
program had a try/except that just printed an error and exited. Without the 
stack trace there was no way to know what the problem was; when he took out 
the try/except it was obvious.

The logging module can help with this - you can put detailed error messages 
in a log file and simple messages in the UI.

Kent

At 11:34 AM 8/12/2004 -0400, Lloyd Kvam wrote:
>         If the program fails in an unexpected area, report the failure and
>exit.  This is likely to be a blanket try/except in main.  It does NOT
>try to keep the program running, but simply provides a graceful
>shutdown.  I like to email program traces back to me so that I can
>quickly respond to problems.



More information about the Tutor mailing list