diff --git a/grpc/src/generated/grpc_examples_echo.rs b/grpc/src/generated/grpc_examples_echo.rs index 5545928b0..39cadb756 100644 --- a/grpc/src/generated/grpc_examples_echo.rs +++ b/grpc/src/generated/grpc_examples_echo.rs @@ -101,9 +101,12 @@ pub mod echo_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( @@ -126,9 +129,12 @@ pub mod echo_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( @@ -150,9 +156,12 @@ pub mod echo_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( @@ -177,9 +186,12 @@ pub mod echo_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( diff --git a/tonic-build/src/client.rs b/tonic-build/src/client.rs index 56c847585..37b9ed72e 100644 --- a/tonic-build/src/client.rs +++ b/tonic-build/src/client.rs @@ -237,14 +237,17 @@ fn generate_unary( &mut self, request: impl tonic::IntoRequest<#request>, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; - let codec = #codec_name::default(); - let path = http::uri::PathAndQuery::from_static(#path); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new(#service_name, #method_name)); - self.inner.unary(req, path, codec).await + self.inner.ready().await.map_err(|e| { + let e = e.into(); + let mut status = tonic::Status::unknown(format!("Service was not ready: {}", e)); + status.set_source(e.into()); + status + })?; + let codec = #codec_name::default(); + let path = http::uri::PathAndQuery::from_static(#path); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new(#service_name, #method_name)); + self.inner.unary(req, path, codec).await } } } @@ -269,7 +272,10 @@ fn generate_server_streaming( request: impl tonic::IntoRequest<#request>, ) -> std::result::Result>, tonic::Status> { self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + let e = e.into(); + let mut status = tonic::Status::unknown(format!("Service was not ready: {}", e)); + status.set_source(e.into()); + status })?; let codec = #codec_name::default(); let path = http::uri::PathAndQuery::from_static(#path); @@ -300,7 +306,10 @@ fn generate_client_streaming( request: impl tonic::IntoStreamingRequest ) -> std::result::Result, tonic::Status> { self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + let e = e.into(); + let mut status = tonic::Status::unknown(format!("Service was not ready: {}", e)); + status.set_source(e.into()); + status })?; let codec = #codec_name::default(); let path = http::uri::PathAndQuery::from_static(#path); @@ -331,7 +340,10 @@ fn generate_streaming( request: impl tonic::IntoStreamingRequest ) -> std::result::Result>, tonic::Status> { self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + let e = e.into(); + let mut status = tonic::Status::unknown(format!("Service was not ready: {}", e)); + status.set_source(e.into()); + status })?; let codec = #codec_name::default(); let path = http::uri::PathAndQuery::from_static(#path); diff --git a/tonic-health/src/generated/grpc_health_v1.rs b/tonic-health/src/generated/grpc_health_v1.rs index 19cee943e..5db7651d6 100644 --- a/tonic-health/src/generated/grpc_health_v1.rs +++ b/tonic-health/src/generated/grpc_health_v1.rs @@ -148,9 +148,12 @@ pub mod health_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( @@ -187,9 +190,12 @@ pub mod health_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( diff --git a/tonic-reflection/src/generated/grpc_reflection_v1.rs b/tonic-reflection/src/generated/grpc_reflection_v1.rs index a78eaf20c..4d76c512b 100644 --- a/tonic-reflection/src/generated/grpc_reflection_v1.rs +++ b/tonic-reflection/src/generated/grpc_reflection_v1.rs @@ -239,9 +239,12 @@ pub mod server_reflection_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( diff --git a/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs b/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs index b2afc7f6a..32fe93db1 100644 --- a/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs +++ b/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs @@ -239,9 +239,12 @@ pub mod server_reflection_client { .ready() .await .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) + let e = e.into(); + let mut status = tonic::Status::unknown( + format!("Service was not ready: {}", e), + ); + status.set_source(e.into()); + status })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static(