You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error handling for API calls that return valid JSON, but don't contain expected fields in the response leaves something to be desired. For example, in inat.py in make_taxa_embed, where a taxon has already been retrieved, but the full taxon record is needed to get full means & status info:
Since the command that was typed was ,t sharks from italy and that ought to have matched the taxon, this sort of failure should probably be handled as a retriable condition in api.py. Unfortunately, we don't know what the record actually looked like. However, we ought to be able to sanity-check the result, such as:
check if there is a "results" at all
if not, log the some reasonable fraction of the response (e.g. first 100 chars?) and raise a (custom?) exception to force a retry
it would be interesting to see what it is actually receiving! we might be able to make our final error message more useful if it repeatedly fails and on the final retry there's useful info contained within the response that we can pass back. but we won't know what that is until we catch it in the act in the logs.
don't forget to add the retry exception to the list of retriable exceptions if it isn't in it already
Finally, carefully check that commands like make_taxa_embed already have exception handling for the final exception raised if the underlying API call runs out of retries and raises a final LookupError (just as we recently did for search / show observation).
The text was updated successfully, but these errors were encountered:
The error handling for API calls that return valid JSON, but don't contain expected fields in the response leaves something to be desired. For example, in inat.py in make_taxa_embed, where a taxon has already been retrieved, but the full taxon record is needed to get full means & status info:
There's no exception handling around this, potentially leading to a traceback like this:
It's not clear why response["results"] is None. For no matches, the API should return this instead:
Since the command that was typed was
,t sharks from italy
and that ought to have matched the taxon, this sort of failure should probably be handled as a retriable condition in api.py. Unfortunately, we don't know what the record actually looked like. However, we ought to be able to sanity-check the result, such as:Finally, carefully check that commands like make_taxa_embed already have exception handling for the final exception raised if the underlying API call runs out of retries and raises a final LookupError (just as we recently did for search / show observation).
The text was updated successfully, but these errors were encountered: