cachapa / firedart

A dart-native implementation of the Firebase Auth and Firestore SDKs
https://pub.dev/packages/firedart
Apache License 2.0
174 stars 62 forks source link

No internet error #4

Closed guyluz11 closed 4 years ago

guyluz11 commented 5 years ago

When I don't have internet I get this exception.

Unhandled exception:
SocketException: Failed host lookup: 'www.googleapis.com' (OS Error: Temporary failure in name resolution, errno = -3)
#0      IOClient.send (package:http/src/io_client.dart:33:23)
<asynchronous suspension>
#1      KeyClient.send (package:firedart/auth/client.dart:56:19)
#2      BaseClient._sendUnstreamed (package:http/src/base_client.dart:169:38)
<asynchronous suspension>
#3      BaseClient.post (package:http/src/base_client.dart:54:7)
#4      AuthGateway._post (package:firedart/auth/auth_gateway.dart:41:33)
<asynchronous suspension>
#5      AuthGateway._auth (package:firedart/auth/auth_gateway.dart:32:21)
<asynchronous suspension>
#6      AuthGateway.signIn (package:firedart/auth/auth_gateway.dart:16:7)
<asynchronous suspension>
#7      FirebaseAuth.signIn (package:firedart/auth/firebase_auth.dart:56:20)
#8      CloudFireStore.listenToChangeOfDataInPath (package:SmartDeviceDart/shered/data_base/cloud_fire_store.dart:46:16)
<asynchronous suspension>
#9      DataBaseController.listenToChangeOfDataInPath (package:SmartDeviceDart/shered/data_base/data_base_controller.dart:27:27)
<asynchronous suspension>
#10     CloudManager.listenToDataBase (package:SmartDeviceDart/shered/data_base/cloud_manager.dart:14:24)
#11     SmartDeviceManager.listenToDataBase (package:SmartDeviceDart/smart_device/smart_device_manager.dart:49:18)
#12     SmartDeviceManager.SmartDeviceMainAsync (package:SmartDeviceDart/smart_device/smart_device_manager.dart:21:5)
<asynchronous suspension>
#13     new SmartDeviceManager (package:SmartDeviceDart/smart_device/smart_device_manager.dart:13:5)
#14     main (file:///home/guyl/Documents/programing/git/SmartHome/SmartDevice/SmartDeviceDart/bin/main.dart:18:3)
<asynchronous suspension>
#15     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
cachapa commented 4 years ago

What would you expect instead of the exception? Firedart in the current state does not attempt to silently retry in the background, like the official libraries do.

All network calls are tried once and will throw the appropriate exception if they fail. Error handling and recovery are left to the user of the library.