def requests_error_handler(func):
    "Re-raise ConnectionError with help message.\n    Continue on HTTP 404 error (server is on but workflow doesn't exist).\n    Otherwise, re-raise from None to hide nested tracebacks.\n    "

    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except HTTPError as err:
            if (err.response.status_code == 404):
                logger.error("Workflow doesn't seem to exist.")
                return
            message = '{err}\n\nCromwell server is on but got an HTTP error other than 404. '.format(err=err)
            raise HTTPError(message) from None
        except ConnectionError as err:
            message = '{err}\n\nFailed to connect to Cromwell server. Check if Caper server is running. Also check if hostname and port are correct. method={method}, url={url}'.format(err=err, method=err.request.method, url=err.request.url)
            raise ConnectionError(message) from None
    return wrapper
Re-raise ConnectionError with help message.
Continue on HTTP 404 error (server is on but workflow doesn't exist).
Otherwise, re-raise from None to hide nested tracebacks.
def requests_error_handler(func):
    "Re-raise ConnectionError with help message.\n    Continue on HTTP 404 error (server is on but workflow doesn't exist).\n    Otherwise, re-raise from None to hide nested tracebacks.\n    "

    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except HTTPError as err:
            if (err.response.status_code == 404):
                logger.error("Workflow doesn't seem to exist.")
                return
            message = '{err}\n\nCromwell server is on but got an HTTP error other than 404. '.format(err=err)
            raise HTTPError(message) from None
        except ConnectionError as err:
            message = '{err}\n\nFailed to connect to Cromwell server. Check if Caper server is running. Also check if hostname and port are correct. method={method}, url={url}'.format(err=err, method=err.request.method, url=err.request.url)
            raise ConnectionError(message) from None
    return wrapper