A decorator that gracefully handles exceptions, exiting
    with :py:obj:`exit_codes.OTHER_FAILURE`.

def catch_exception(exception, message=None):
    """A decorator that gracefully handles exceptions, exiting
    with :py:obj:`exit_codes.OTHER_FAILURE`.
    """
    def decorator(f):
        @click.pass_context
        def new_func(ctx, *args, **kwargs):
            try:
                return ctx.invoke(f, *args, **kwargs)
            except exception as e:
                message1 = message if message is not None else '{}'.format(e)
                click.echo(message1)
                ctx.exit(code=exit_codes.OTHER_FAILURE)
        return update_wrapper(new_func, f)
    return decorator