Forward error (#640)

* Forward error

* Add changelog

* Switch version
This commit is contained in:
Moritz 2023-07-13 13:30:58 +02:00 committed by GitHub
parent c7e07a09a5
commit 1c18e38252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View File

@ -1,3 +1,7 @@
## 3.2.4-wip
* Forward internal `GrpcError` on when throwing while sending a request.
## 3.2.3
* Add const constructor to `GrpcError` fixing #606.

View File

@ -207,7 +207,9 @@ class ClientCall<Q, R> implements Response {
_terminateWithError(GrpcError.unavailable('Error connecting: $error'));
}
void _terminateWithError(GrpcError error) {
void _terminateWithError(Object e) {
final error =
e is GrpcError ? e : GrpcError.unavailable('Error making call: $e');
_finishTimelineWithError(error, _requestTimeline);
_responses.addErrorIfNotClosed(error);
_safeTerminate();
@ -245,14 +247,10 @@ class ClientCall<Q, R> implements Response {
(MetadataProvider provider) => provider(metadata,
'${connection.scheme}://${connection.authority}${audiencePath(_method)}'))
.then((_) => _sendRequest(connection, _sanitizeMetadata(metadata)))
.catchError(_onMetadataProviderError);
.catchError(_terminateWithError);
}
}
void _onMetadataProviderError(error) {
_terminateWithError(GrpcError.internal('Error making call: $error'));
}
void _sendRequest(ClientConnection connection, Map<String, String> metadata) {
late final GrpcTransportStream stream;
try {
@ -264,7 +262,7 @@ class ClientCall<Q, R> implements Response {
callOptions: options,
);
} catch (e) {
_terminateWithError(GrpcError.unavailable('Error making call: $e'));
_terminateWithError(e);
return;
}
_requestTimeline?.instant('Request sent', arguments: {

View File

@ -1,6 +1,6 @@
name: grpc
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
version: 3.2.3
version: 3.2.4-wip
repository: https://github.com/grpc/grpc-dart