-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give better error message if record not found #44
Comments
For instance, this is what we get from the API at the moment: > artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
Error in `private$process_response()`:
! list index out of range I'd say this is up to the API to do better error handling to provide more descriptive error messages. For instance, in this case the API should be something like We could implement functionality to map the most common error messages returned by the API into something that is understandable from the perspective of an R user, but at this point it seems the API is simply returning whatever goes wrong inside of the Python code, so there is no knowing which error messages the API might return. |
I agree. @fredericenard can comment how fast this can be done. |
I did this here for the get record endpoint. |
Thanks for resolving, Fred! Just: Robrecht and Luke won't see what you did because they don't have access to the laminhub repo |
I just checked with the current main branch and we get this error output: artifact <- db$Artifact$get("FAKEID")
#> Error in `private$process_response()` at laminr/R/InstanceAPI.R:109:7:
#> ! Failed to get record from instance
#> ℹ Details: 404: Record not found. Which I think is the result of the API changes and some fixes we made to how the response is processed. I think this is ok but I'll add the status code and a test for this case. This isn't the case for everything though. For example, if you put nonsense in the search field the API doesn't tell you anything about what the issue is: api$get_record("core", "artifact", "mePviem4DGM4SFzvLXf3", select = "foo")
#> Error in `private$process_response()` at laminr/R/InstanceAPI.R:109:7:
#> ! Failed to get record from instance with status code 500
#> ℹ Details: 'foo' |
If possible with the API, give a different error if a request is successful but a record is not in the database, versus if a request fails completely.
The text was updated successfully, but these errors were encountered: