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

The error messages are not user-friendly and don't follow i18n translations #1351

Open
Francesco146 opened this issue May 20, 2024 · 0 comments

Comments

@Francesco146
Copy link
Contributor

Describe the bug

The error message that is shown to the end user, which occurs at the abrupt stop of an established connection, contains the type of exception generated at runtime. it would be better to show only the content of the message to have a more user-friendly behavior. Also, it would be better to add the most common errors in the i18n translation files, currently they do not follow the system language.

To reproduce

  1. Start a sharing connection
  2. Stop it before it finishes
  3. Click on the error to see the details
  4. See error

Expected behavior

The error should be more user friendly, not including the DioException [request cancelled] part.

Screenshots

immagine

Desktop (please complete the following information)

All OS/versions are affected

Smartphone (please complete the following information)

All OS/versions are affected

Additional context

This might be where the changes are needed:

https://github.com/localsend/localsend/blob/8f652cf5696ac1660f4fac6f36f85e28b14ab236/app/lib/provider/network/send_provider.dart#L442C1-L458C2

// app/lib/provider/network/send_provider.dart:442
extension on Object {
  String get humanErrorMessage {
    final e = this;
    if (e is DioException && e.response != null) {
      final body = e.response!.data;
      String message;
      try {
        message = (body as Map)['message'];
      } catch (_) {
        message = body;
      }
      return '[${e.response!.statusCode}] $message';
    }

    return e.toString();
  }
}
@Francesco146 Francesco146 changed the title The error messages are not user-friendly The error messages are not user-friendly and don't follow i18n translations May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant