Closed almosnow closed 2 weeks ago
Using the RTK api client for all api requests and error messages is probably the best way to go. I'm already using it with all non-proxy endpoints https://github.com/serratus-bio/open-virome/blob/main/frontend/src/api/client.ts
Hmm, bit of an unrelated issue.
This is about getting an error message (on the client) when a query fails because of something that's related to postgres (most common one would be a query syntax error).
the RTK client does error handling on the UI (also helps with caching and retries)*
Try,
curl 'https://zrdbegawce.execute-api.us-east-1.amazonaws.com/prod/counts' -H 'content-type: application/json' --data-raw '{"idColumn":"bioproject","ids":["YEAH IM NOT SO SURE OF THAT"],"idRanges":[],"groupBy":"organism"}'
Gives back W10=
, no error message.
In this case it's pretty clear why that query is wrong, but in some cases not so much.
I'll just do a giant try/catch and forward all errors to the frontend.
What's the advantage of the RTK api client? I'm unaware of the difference between the methods here.
Please add a Time Estimate:
for this issue.
Time spent was ~hour.
Errors that come from a database query or procedure (not from the lambda per se) are not being surfaced out
This makes things much harder to debug
Fix is adding try/catch causes and explicitly checking for errors after each db call (which fortunately is only two files now)