Next / Previous / Contents / TCC Help System / NM Tech homepage

22. fatal(): Write a message and stop

When an any unexpected error occurs, this routine is called to write a message to the standard error stream and terminate execution. Since this script is intended to be run as a cron job, these errors will be e-mailed to the script's owner.

webstats.py
# - - -   f a t a l   - - -

def fatal ( *L ):
    """Write an error message and terminate.

      [ L is a list of strings ->
          sys.stderr  +:=  elements of L, concatenated
          stop execution ]
    """
    error ( "Fatal error: ", "".join(L) )
    sys.exit ( 1 )