Skip to content

Commit

Permalink
fix: viguno hpo search response for not found (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo authored Jul 19, 2024
1 parent 736c8f9 commit 2b47962
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/api/viguno/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ describe.concurrent('Viguno Client', () => {

it('handles server error when resolving HPO term by ID', async () => {
// arrange:
const errorMessage = 'Internal Server Error'
// const errorMessage = 'Internal Server Error'
const errorMessage = 'HPO term not found'
fetchMocker.mockResponseOnce(JSON.stringify({ msg: errorMessage }), { status: 500 })

// act:
Expand Down
8 changes: 6 additions & 2 deletions src/api/viguno/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ export class VigunoClient {
})

if (!response.ok) {
const errorBody = await response.json()
throw new StatusCodeNotOk(errorBody.msg || response.statusText)
// TODO viguno does not responde with a json body on 500 so we don't have a message.
// TODO once this is fixed in viguno, we can use the code below.
// TODO https://github.com/varfish-org/viguno/issues/186
// const errorBody = await response.json()
// throw new StatusCodeNotOk(errorBody.msg || response.statusText)
throw new StatusCodeNotOk('HPO term not found')
}

try {
Expand Down

0 comments on commit 2b47962

Please sign in to comment.