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

Problem in the catch block of query.getObjects() #14

Closed
mfarizon opened this issue Jul 29, 2019 · 2 comments
Closed

Problem in the catch block of query.getObjects() #14

mfarizon opened this issue Jul 29, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mfarizon
Copy link

Dart version: [2.4.0]
Flutter version: [1.7.8+hotfix.3 (stable)]
Algolia Dart Client version : [0.1.6+1]

Describe the bug
I think there is a problem with the error handling of the function getObjects(). It returns the catched error, which is creating an other exception : 'type 'SocketException' is not a subtype of type 'FutureOr<AlgoliaQuerySnapshot>', as it is trying to cast the error (SocketExcpetion here) into the return type (Future<AlgoliaQuerySnapshot>). My guess is that it would be better to rethrow the error or handling the errors properly.

To Reproduce
Try calling getObjects on a query with no internet connection on the device.

Expected behavior
Throw typed Exceptions, in order to be able to catch the exception with

try {
      AlgoliaQuerySnapshot snap = await query.getObjects();
} on SocketException catch(e) {
      print(e)
      // Error handling
}
@mfarizon mfarizon added the bug Something isn't working label Jul 29, 2019
kdy1 added a commit to kdy1/dart_algolia that referenced this issue Jul 31, 2019
@HiroyukiTamura
Copy link

I've got same error.
looking forward for update.

@nhathiwala
Copy link
Member

The update has been resolved in version 1.7, you may try updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants