Skip to content

Commit

Permalink
Fix unnecessary else following returns
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonj04 committed Nov 9, 2023
1 parent 4523e9e commit 300baff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/openapi_server/apis/reading_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 10 additions & 10 deletions src/openapi_server/apis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)

0 comments on commit 300baff

Please sign in to comment.