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] Fix stream error report on iOS #2305

Closed

Conversation

mono0926
Copy link
Contributor

@mono0926 mono0926 commented Apr 5, 2020

Description

Fixes #185.

On iOS, there were no reports about stream error.
For "Query#addSnapshotListener" and "DocumentReference#addSnapshotListener", error should be sent by calling [weakSelf.channel invokeMethod:], not result().
Calling result() doesn't make sense for this case.

On Android, it also doesn't send error, but System.out.println(e) is called instead:

iOS's behavior should follow this.

And, It is very useful to know what error was occurred and how to fix it from the error log.
Typical error for this is index error like this, so printing the error is enough in most cases.

W/Firestore(23867): (21.3.0) [Firestore]: Listen for Query(tests where foo == bar order by -foo2, -name) failed: Status{code=FAILED_PRECONDITION, description=The query requires an index. You can create it here: https://console.firebase.google.com/v1/r/project/xxxxxxxx/firestore/indexes?create_composite=xxxxxxxxxxxxxxxxx, cause=null}

Of course, it is better to send error to dart side, so // TODO: send error is reasonable.

Related Issues

#185, as mentioned above.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • If the pull request affects only one plugin, the PR title starts with the name of the plugin in brackets (e.g. [cloud_firestore])
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
    • It is hard to write test about this, and exiting Android implementation have no tests about this.
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

I cannot determin whether this is breaking change or not, but I think "no" because calling result() didn't make sense and NSLog was just added.

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@mono0926
Copy link
Contributor Author

Why no response?

@mono0926
Copy link
Contributor Author

@collinjackson

Could you check this, please?

@mono0926 mono0926 force-pushed the fix-firestore-ios-stream-error-report branch from 900a5b0 to be6ba8b Compare June 29, 2020 01:16
@Salakar
Copy link
Member

Salakar commented Jul 10, 2020

Hey @mono0926 - really appreciate you contributing and sending up this PR, thank you. We've already fixed this in our rework PR (#2913) which has now been merged, so I'm going to go ahead and close this PR as it's no longer required. Please don't hesitate to contribute again in future though :)

@Salakar Salakar closed this Jul 10, 2020
@firebase firebase locked and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[cloud_firestore] Firestore collection stream does not report errors
3 participants