Skip to content
Merged
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
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-235.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: The error instance ID of remote errors is now propagated.
links:
- https://github.com/palantir/conjure-rust-runtime/pull/235
10 changes: 6 additions & 4 deletions conjure-runtime/src/service/http_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::raw::Service;
use crate::service::Layer;
use crate::{builder, Builder, ServerQos, ServiceError};
use bytes::{BufMut, BytesMut};
use conjure_error::Error;
use conjure_error::{Error, ErrorType, Internal};
use conjure_serde::json;
use futures::StreamExt;
use http::header::RETRY_AFTER;
Expand Down Expand Up @@ -149,9 +149,11 @@ where
let e = e.clone();
Error::propagated_service_safe(error, e)
}
(Some(_), ServiceError::WrapInNewError) | (None, _) => {
Error::internal_safe(error)
(Some(e), ServiceError::WrapInNewError) => {
let instance_id = e.error_instance_id();
Error::service_safe(error, Internal::new().with_instance_id(instance_id))
}
(None, _) => Error::internal_safe(error),
};

if log_body {
Expand Down Expand Up @@ -300,7 +302,7 @@ mod test {
_ => panic!("expected a service error"),
};
assert_eq!(*service.error_code(), ErrorCode::Internal);
assert_ne!(
assert_eq!(
service.error_instance_id(),
service_error.error_instance_id()
);
Expand Down