varfish-org / viguno

Versatile Interface for Genetics Utilization of Nice Ontologies
Apache License 2.0
0 stars 0 forks source link

hpo term id search 500 error response not in json format #186

Open stolpeo opened 2 months ago

stolpeo commented 2 months ago

Describe the bug In case a query for an HPO term fails because it can't be found, an 500 error message is issued with a string describing the error. However downstream tools like reev-frontend-lib have issues processing the error response because the response data is expected to be in json format.

https://github.com/varfish-org/viguno/blob/c6a8213f31b2c86aa1bebd2547d5fd4751af9c63/src/server/run/hpo_terms.rs#L277

To Reproduce

$ curl -i http://localhost:8000/proxy/varfish/viguno/hpo/terms?term_id=HP%3A2134567
HTTP/1.1 500 Internal Server Error
Server: WSGIServer/0.2 CPython/3.10.12
content-type: text/plain; charset=utf-8
date: Fri, 19 Jul 2024 08:44:24 GMT
Server-Timing: TimerPanel_utime;dur=15.056000000015501;desc="User CPU time", TimerPanel_stime;dur=0.0;desc="System CPU time", TimerPanel_total;dur=15.056000000015501;desc="Total CPU time", TimerPanel_total_time;dur=15.667679952457547;desc="Elapsed time", SQLPanel_sql_time;dur=0;desc="SQL 0 queries", CachePanel_total_time;dur=0;desc="Cache 0 Calls"
X-Frame-Options: DENY
Content-Length: 35
Vary: Cookie
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin

Term ID HP:2134567 not found in HPO  # SHOULD BE JSON FORMAT
stolpeo commented 2 months ago

There might be other error responses as well not responding in JSON format.

stolpeo commented 2 months ago

Additionally, reev-frontend-lib seems to expect a 404 in this case, according to the tests. So probably also the return code is not correct.

https://github.com/bihealth/reev-frontend-lib/blob/736c8f9fab0a51a8e20340e12b556c298c5615bf/src/api/viguno/client.spec.ts#L180