Error handling utility. Print more or less error information
       depending on debug flag. Unless abort is set False, exits with
       error code 1.

def handleError(exception, debugFlag=False, abortFlag=True):
    """Error handling utility. Print more or less error information
       depending on debug flag. Unless abort is set False, exits with
       error code 1."""
    if isinstance(exception, CmdError) or not debugFlag:
        error(str(exception))
    else:
        import traceback
        traceback.print_exc()
        error(str(exception))   # or log complete traceback as well?
    if abortFlag:
        sys.exit(1)