Skip to content
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

RESTClient: review raised exceptions and provide user friendly alternatives #1281

Closed
rudolfix opened this issue Apr 25, 2024 · 2 comments
Closed
Assignees
Labels
sprint Marks group of tasks with core team focus at this moment

Comments

@rudolfix
Copy link
Collaborator

rudolfix commented Apr 25, 2024

Several components (mostly Paginators) raise general Python exceptions (ie. ValueError) instead of providing actionable information on what went wrong.

Review the code base and raise customized exception
Take known user feedback in mind ie. Better error handling: display the content of the error document if present

@rudolfix rudolfix added the sprint Marks group of tasks with core team focus at this moment label Apr 25, 2024
@rudolfix rudolfix self-assigned this Apr 25, 2024
@sh-rp
Copy link
Collaborator

sh-rp commented Apr 30, 2024

One probably quite typical case is the pokemon api. We have an openapi spec which misleads the generator into mapping incorrect fields from the parent object to the child url (in the generator resource). This means rest_api tries to look up a value in the parent object which does not exist as a key there. Right now the error is obscure, what would be nice is something like:

Error while processing child resource, expected key "id" not found in parent object of type "pokemon", available keys are: "name", "url". Please update your pokemon endpoint.

This might require changes in the rest helper as well as the rest api.

@rudolfix
Copy link
Collaborator Author

@sh-rp your feedback is implemented in rest_api. I added a lot of exceptions there. but they are all ValueError. We'll make an exception tree later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sprint Marks group of tasks with core team focus at this moment
Projects
Status: Done
Development

No branches or pull requests

2 participants