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

Exceptions are swallowed #177

Closed
venkatd opened this issue Feb 22, 2019 · 2 comments
Closed

Exceptions are swallowed #177

venkatd opened this issue Feb 22, 2019 · 2 comments
Assignees
Labels
🐛 bug Something isn't working enhancement New feature or request next Feature or report is related to next
Milestone

Comments

@venkatd
Copy link

venkatd commented Feb 22, 2019

Related to #140

In most of the try ... catch clauses in the code, we are catching all exceptions. This results in errors unrelated to the library (such as network errors) getting swallowed which makes things very difficult to debug.

For example:
https://github.com/zino-app/graphql-flutter/blob/f7d50caf4e4999761ac8c128097ff90b3e19bb99/lib/src/widgets/query.dart#L90

https://github.com/zino-app/graphql-flutter/blob/f7d50caf4e4999761ac8c128097ff90b3e19bb99/lib/src/widgets/query.dart#L107

The solution would be to catch on specific exceptions. We do this in our own code for example:

  _login(BuildContext context) async {
    try {
      await auth.signIn();

      Navigator.of(context).pushReplacement(
        new MaterialPageRoute(
          builder: (context) {
            return DashboardContainer();
          },
        ),
      );
    } on GoogleSignInFailedError catch (error) {
      _showLoginFailed(context, error);
    } on TurtleSignInFailedError catch (error) {
      _showLoginFailed(context, error);
    }
  }

If there is any other exception besides what we explicitly catch, it will properly get raised so a developer can debug easily.

@HofmannZ
Copy link
Member

I think we could solve this by creating our own kind of exceptions so that we can handle them cleaner internally.

@truongsinh
Copy link
Collaborator

closed by #193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working enhancement New feature or request next Feature or report is related to next
Projects
None yet
Development

No branches or pull requests

3 participants