Skip to content

Commit 5e9465f

Browse files
committed
propagate result
1 parent f49fcaa commit 5e9465f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

dogstatsd/src/datadog.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,9 @@ impl DdApi {
151151
/// Ship a serialized series to the API, blocking
152152
pub async fn ship_series(&self, series: &Series) -> Result<Response, ShippingError> {
153153
let url = format!("{}/api/v2/series", &self.metrics_intake_url_prefix);
154-
if let Ok(safe_body) = serde_json::to_vec(&series) {
155-
debug!("Sending body: {:?}", &series);
156-
self.ship_data(url, safe_body, "application/json").await
157-
} else {
158-
Err(ShippingError::Payload(
159-
"Failed to serialize series".to_string(),
160-
))
161-
}
154+
let safe_body = serde_json::to_vec(&series).map_err(|_| ShippingError::Payload("Failed to serialize series".to_string()))?;
155+
debug!("Sending body: {:?}", &series);
156+
self.ship_data(url, safe_body, "application/json").await
162157
}
163158

164159
pub async fn ship_distributions(

0 commit comments

Comments
 (0)