diff --git a/src/openapi_server/apis/reading_api.py b/src/openapi_server/apis/reading_api.py index 5f94199..65ac904 100644 --- a/src/openapi_server/apis/reading_api.py +++ b/src/openapi_server/apis/reading_api.py @@ -41,8 +41,7 @@ def unpack_list(xpath_list): ), f"There should only be one response, but there were {len(xpath_list)}: \n {xpath_list}" if xpath_list: return xpath_list[0] - else: - return None + return None @router.get( diff --git a/src/openapi_server/apis/utils.py b/src/openapi_server/apis/utils.py index a3260b8..cc84a37 100644 --- a/src/openapi_server/apis/utils.py +++ b/src/openapi_server/apis/utils.py @@ -26,14 +26,14 @@ def error_response(e): namespaces={"mlerror": "http://marklogic.com/xdmp/error"}, )[0] raise HTTPException(status_code=e.status_code, detail=error_message) - elif isinstance(e, MarklogicAPIError): + + if isinstance(e, MarklogicAPIError): raise HTTPException(status_code=e.status_code, detail=e.default_message) - else: - # presumably a Python error, not a Marklogic one - logging.exception( - "A Python error in the privileged API occurred whilst making a request to Marklogic", - ) - raise HTTPException( - status_code=500, - detail="An unknown error occurred outside of Marklogic.", - ) + + logging.exception( + "A Python error in the privileged API occurred whilst making a request to Marklogic", + ) + raise HTTPException( + status_code=500, + detail="An unknown error occurred outside of Marklogic.", + )