Skip to content

Commit

Permalink
exception
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Feb 5, 2024
1 parent d1ba038 commit f97c5ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/ansible_openvpn/docker/dashboard/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ async def get_samples(request: Request, document_id: str):
templates.get_template("trigger_audio.json").render(id=document_id))
resp = client.search(**post_data)
# reformat elastic search result
return resp["hits"]["hits"][0]["_source"]
try:
return resp["hits"]["hits"][0]["_source"]
except IndexError as e:
raise Exception(e, "Error parsing document required by " + post_data)


@app.get('/', response_class=HTMLResponse)
Expand Down

0 comments on commit f97c5ff

Please sign in to comment.