firedart
firedart copied to clipboard
Missed step in _handleError function?
https://github.com/cachapa/firedart/blob/4dfe0bb0a52c8edc888860245e4899f8f1d9f3f7/lib/firestore/firestore_gateway.dart#L221
In the _handleError function we have if statement that check for specific type of error, and if it does it is setting up the client again with call to the function _setupClient() in order to restart itself after the error I presume.
After _setupClient() was called (to handle the GrpcError) the code continue to the throw statement.
void _handleError(e) {
print('Handling error $e using FirestoreGateway._handleError');
if (e is GrpcError &&
[
StatusCode.unknown,
StatusCode.unimplemented,
StatusCode.internal,
StatusCode.unavailable,
StatusCode.unauthenticated,
StatusCode.dataLoss,
].contains(e.code)) {
_setupClient();
}
throw e;
}
I think we need to add return statement after calling _setupClient so that it will not crash the program, like this
void _handleError(e) {
print('Handling error $e using FirestoreGateway._handleError');
if (e is GrpcError &&
[
StatusCode.unknown,
StatusCode.unimplemented,
StatusCode.internal,
StatusCode.unavailable,
StatusCode.unauthenticated,
StatusCode.dataLoss,
].contains(e.code)) {
_setupClient();
return;
}
throw e;
}
Related to #43 as I am getting the error
Handling error gRPC Error (code: 14, codeName: UNAVAILABLE, message: Missing trailers, details: null, rawResponse: null) using FirestoreGateway._handleError
Unhandled exception:
gRPC Error (code: 14, codeName: UNAVAILABLE, message: Missing trailers, details: null, rawResponse: null)
Asking this before creating pull request just to make sure that I am not missing anything.