Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions grpc/src/generated/grpc_examples_echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
34 changes: 23 additions & 11 deletions tonic-build/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,17 @@ fn generate_unary<T: Service>(
&mut self,
request: impl tonic::IntoRequest<#request>,
) -> std::result::Result<tonic::Response<#response>, 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
}
}
}
Expand All @@ -269,7 +272,10 @@ fn generate_server_streaming<T: Service>(
request: impl tonic::IntoRequest<#request>,
) -> std::result::Result<tonic::Response<tonic::codec::Streaming<#response>>, 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);
Expand Down Expand Up @@ -300,7 +306,10 @@ fn generate_client_streaming<T: Service>(
request: impl tonic::IntoStreamingRequest<Message = #request>
) -> std::result::Result<tonic::Response<#response>, 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);
Expand Down Expand Up @@ -331,7 +340,10 @@ fn generate_streaming<T: Service>(
request: impl tonic::IntoStreamingRequest<Message = #request>
) -> std::result::Result<tonic::Response<tonic::codec::Streaming<#response>>, 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);
Expand Down
18 changes: 12 additions & 6 deletions tonic-health/src/generated/grpc_health_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@
.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),

Check failure on line 153 in tonic-health/src/generated/grpc_health_v1.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
);
status.set_source(e.into());
status
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand Down Expand Up @@ -187,9 +190,12 @@
.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),

Check failure on line 195 in tonic-health/src/generated/grpc_health_v1.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
);
status.set_source(e.into());
status
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand Down
9 changes: 6 additions & 3 deletions tonic-reflection/src/generated/grpc_reflection_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,12 @@
.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),

Check failure on line 244 in tonic-reflection/src/generated/grpc_reflection_v1.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
);
status.set_source(e.into());
status
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand Down
9 changes: 6 additions & 3 deletions tonic-reflection/src/generated/grpc_reflection_v1alpha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,12 @@
.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),

Check failure on line 244 in tonic-reflection/src/generated/grpc_reflection_v1alpha.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
);
status.set_source(e.into());
status
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand Down
Loading