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

[cloud_firestore] snapshots should have stream errors when errors occur in Query #384

Closed
kroikie opened this issue Oct 13, 2019 · 4 comments
Labels
plugin: cloud_firestore resolution: duplicate This issue or pull request already exists type: enhancement New feature or request

Comments

@kroikie
Copy link
Collaborator

kroikie commented Oct 13, 2019

Originally posted by @ened in flutter/flutter#13904 (comment)

Can confirm Firestore does not crash anymore in case of a missing index. There is clear error description in the logs.

I would, however, expect the AsyncSnapshot to have the error field clearly set.

Sample code:

StreamBuilder<QuerySnapshot>(
  stream: state.myQuery,
  builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
    if (snapshot.hasError) {
      return Text('Error: ${snapshot.error}');
    }
    print('snapshot: ${snapshot.connectionState}');
    switch (snapshot.connectionState) {
      case ConnectionState.done:
      case ConnectionState.waiting:
        return Container(
          child: const Center(child: CircularProgressIndicator()),
        );

      default:
        if (snapshot.data.documents.isEmpty) {
          return _buildEmptyPage();
        }

        return _buildListView(snapshot, context);
    }
  },
),

snapshot.error & snapshot.hasError really should be set in that case.

@kroikie
Copy link
Collaborator Author

kroikie commented Oct 13, 2019

@collinjackson

The issue at flutter/flutter#31988 has been closed and moved here. Future collaboration on this issue will be done here.

@iapicca iapicca added the type: enhancement New feature or request label Oct 22, 2019
@iapicca iapicca changed the title cloud_firestore snapshots should have stream errors when errors occur in Query [cloud_firestore] snapshots should have stream errors when errors occur in Query Oct 23, 2019
@dustin-graham
Copy link

@kroikie Any update on this? This is definitely a challenge in our project. When we stream snapshots we will often find ourselves waiting for data which never returns because there was an underlying error which is never reported to us. When we go fetch the data once we get errors right away. Errors need to be reported consistently regardless of doing a single fetch or observing a stream of changes. I think the only way we can work around this failure mode is to always do a single fetch first and then a stream of snapshots after. Is there any plans to change this behavior?

@allco
Copy link

allco commented Apr 9, 2020

@dustin-graham I have the same issue with error is not being reported, I have created another issue for this: #2334

@Salakar
Copy link
Member

Salakar commented Apr 21, 2020

Consolidating under #1223 - we'll be looking at parsing native error messages & codes and bubbling these up to the Dart layer in a consistent cross-platform format.

@Salakar Salakar closed this as completed Apr 21, 2020
@Salakar Salakar added the resolution: duplicate This issue or pull request already exists label Apr 21, 2020
@firebase firebase locked and limited conversation to collaborators Aug 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: cloud_firestore resolution: duplicate This issue or pull request already exists type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants