Skip to content

Commit

Permalink
Issue-#1: Don't break with invalid HPO terms in batch-POST similarity…
Browse files Browse the repository at this point in the history
… request
  • Loading branch information
Jonas Marcello committed Apr 9, 2021
1 parent 2b0e844 commit 4573f4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pyhpoapi/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ def get_hpo_set(set_query: str) -> HPOSet:
except Exception:
raise HTTPException(
status_code=400,
detail='Invalid query'
detail='Invalid query',
headers={'X-Error': 'Invalid query provided'}
)
4 changes: 3 additions & 1 deletion pyhpoapi/routers/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ async def batch_similarity(
)
except HTTPException as ex:
res['similarity'] = None
res['error'] = ex.headers['X-TermNotFound'] # type: ignore
res['error'] = ex.headers.get(
'X-TermNotFound', 'Unknown error'
) # type: ignore

other_sets.append(res)
return {
Expand Down

0 comments on commit 4573f4f

Please sign in to comment.