Skip to content

Commit

Permalink
[opentelemetry-otlp][tonic] Add more information to error message for…
Browse files Browse the repository at this point in the history
… Unknown status code (#1931)
  • Loading branch information
utpilla authored Jul 12, 2024
1 parent 597327f commit a2e435f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions opentelemetry-otlp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,17 @@ impl From<tonic::Status> for Error {
code: status.code(),
message: {
if !status.message().is_empty() {
", detailed error message: ".to_string() + status.message()
let mut result = ", detailed error message: ".to_string() + status.message();
if status.code() == tonic::Code::Unknown {
let source = (&status as &dyn std::error::Error)
.source()
.map(|e| format!("{:?}", e));
result.push(' ');
result.push_str(source.unwrap_or_default().as_ref());
}
result
} else {
"".to_string()
String::new()
}
},
}
Expand Down

0 comments on commit a2e435f

Please sign in to comment.