def err_exit(message='', code=None, expected_exceptions=default_expected_exceptions, arg_parser=None,
             ignore_sigpipe=True, exception=None):
    '''Exits the program, printing information about the last exception (if
    any) and an optional error message.  Uses *exception* instead if provided.

    Uses **expected_exceptions** to set the error code decide whether to
    suppress the error traceback.

    :param message: Message to be printed after the exception information.
    :type message: string
    :param code: Exit code.
    :type code: integer (valid exit code, 0-255)
    :param expected_exceptions: Exceptions for which to exit with error code 3 (expected error condition) and suppress the stack trace (unless the _DX_DEBUG environment variable is set).
    :type expected_exceptions: iterable
    :param arg_parser: argparse.ArgumentParser object used in the program (optional)
    :param ignore_sigpipe: Whether to exit silently with code 3 when IOError with code EPIPE is raised. Default true.
    :type ignore_sigpipe: boolean
    :param exception: an exception to use in place of the last exception raised
    '''
    if arg_parser is not None:
        message = arg_parser.prog + ": " + message

    exc = exception if exception is not None else sys.exc_info()[1]
    if isinstance(exc, SystemExit):
        raise exc
    elif isinstance(exc, expected_exceptions):
        exit_with_exc_info(EXPECTED_ERR_EXIT_STATUS, message, print_tb=dxpy._DEBUG > 0, exception=exception)
    elif ignore_sigpipe and isinstance(exc, IOError) and getattr(exc, 'errno', None) == errno.EPIPE:
        if dxpy._DEBUG > 0:
            print("Broken pipe", file=sys.stderr)
        sys.exit(3)
    else:
        if code is None:
            code = 1
        exit_with_exc_info(code, message, print_tb=True, exception=exception)
def err_exit ( message = '' , code = None , expected_exceptions = default_expected_exceptions , arg_parser = None , ignore_sigpipe = True , exception = None ) : if arg_parser is not None : message = arg_parser . prog + ": " + message exc = exception if exception is not None else sys . exc_info ( ) [ 1 ] if isinstance ( exc , SystemExit ) : raise exc elif isinstance ( exc , expected_exceptions ) : exit_with_exc_info ( EXPECTED_ERR_EXIT_STATUS , message , print_tb = dxpy . _DEBUG > 0 , exception = exception ) elif ignore_sigpipe and isinstance ( exc , IOError ) and getattr ( exc , 'errno' , None ) == errno . EPIPE : if dxpy . _DEBUG > 0 : print ( "Broken pipe" , file = sys . stderr ) sys . exit ( 3 ) else : if code is None : code = 1 exit_with_exc_info ( code , message , print_tb = True , exception = exception )
Exits the program, printing information about the last exception (if
    any) and an optional error message.  Uses *exception* instead if provided.

    Uses **expected_exceptions** to set the error code decide whether to
    suppress the error traceback.

    :param message: Message to be printed after the exception information.
    :type message: string
    :param code: Exit code.
    :type code: integer (valid exit code, 0-255)
    :param expected_exceptions: Exceptions for which to exit with error code 3 (expected error condition) and suppress the stack trace (unless the _DX_DEBUG environment variable is set).
    :type expected_exceptions: iterable
    :param arg_parser: argparse.ArgumentParser object used in the program (optional)
    :param ignore_sigpipe: Whether to exit silently with code 3 when IOError with code EPIPE is raised. Default true.
    :type ignore_sigpipe: boolean
    :param exception: an exception to use in place of the last exception raised