Graceful handling of API HTTP 4xx responses #1109
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
lifecycle/frozen
Indicates that an issue or PR should not be auto-closed due to staleness.
priority/important-soon
Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
sig/user-experience
Issues or PRs related to the User Experience of our Services, Tools, and Libraries.
Problem statement
I ran a quick test of running
thamos
on an unsupported platform (FreeBSD), and I received this:I believe that it would be good to provide a more user-friendly error message here; at first look, this might look as a bug in the code (either client or server side), and it might not be clear enough, for this case, that the resolver will not work on this platform and why.
High-level Goals
As a user, I would like to see friendly messages that help me quickly identify the causes of problems that result in "bad requests", so that I can better understand what's happening and how can I proceed.
Proposal description
Provide a friendly message.
At a minimum, it might be enough to present the response body (and potentially relevant header fields) in a nicely formatted way, e.g. for the example above:
Beyond that, it would be helpful to automatically identify a few "expected" or common problems and provide a custom message for them, e.g.
and potentially point to https://khemenu.thoth-station.ninja/api/v1/ui/#/PythonPackages/get_python_platform or even get its contents and print them nicely.
Additional context
See also thoth-station/user-api#1595 for current inconsistent 400 HTTP responses, depending on what triggered them, as this might be something to keep in mind when implementing the handling on the client side.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: