Skip to content

Consistently interpret API errors for user #741

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

Open
gnprice opened this issue Jun 18, 2024 · 0 comments
Open

Consistently interpret API errors for user #741

gnprice opened this issue Jun 18, 2024 · 0 comments
Labels
a-api Implementing specific parts of the Zulip server API

Comments

@gnprice
Copy link
Member

gnprice commented Jun 18, 2024

When the user tries to do something that calls for an API request, and the request fails, we should show them an error dialog with a useful error message.

In some cases we'll have specific logic to interpret the error, but in general we should show them (a) the error message the server sent, if we got one; (b) if we weren't even able to complete the HTTP request, then whatever error message we got from the system about that (via our NetworkException type).

We already do this in a lot of places, in particular on the various actions the user can choose from the message action sheet (in lib/widgets/action_sheet.dart). But in other places we call showErrorDialog with something like e.toString(), where e is just the exception we caught.

This issue is to

  • factor that logic out in a clean way, to the extent it's reusable (which a lot of it is);
  • test that factored-out code for all the different cases of what an ApiRequestException can look like, so that we're making explicit choices about what the error message looks like in each case;
  • use that logic consistently. In particular, search for call sites of showErrorDialog and make sure those use this logic where appropriate; and search for TODO comments referring to this issue, and resolve those.

Related issues, which may overlap with this one:

@gnprice gnprice added the a-api Implementing specific parts of the Zulip server API label Jun 18, 2024
@gnprice gnprice added this to the Launch milestone Jun 18, 2024
@gnprice gnprice modified the milestones: Launch, Post-launch Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-api Implementing specific parts of the Zulip server API
Projects
Status: No status
Development

No branches or pull requests

1 participant