Skip to content

Commit 2cfaf71

Browse files
committed
fix(targets): enhance error handling in perform
1 parent 0ba61b0 commit 2cfaf71

File tree

1 file changed

+19
-6
lines changed
  • crates/service/src/settings/targets

1 file changed

+19
-6
lines changed

crates/service/src/settings/targets/mod.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,25 @@ impl RequestBuilderPerform for RequestBuilder {
267267
Ok(response)
268268
}
269269

270-
Err(e) => Err(anyhow::anyhow!(
271-
"failed to {} {}: {}",
272-
built.method(),
273-
built.url(),
274-
e,
275-
)),
270+
Err(e) => {
271+
let status = e.status();
272+
if let Some(status) = status {
273+
return Err(anyhow::anyhow!(
274+
"failed to {} {}: {} - {}",
275+
built.method(),
276+
built.url(),
277+
status,
278+
e
279+
));
280+
}
281+
282+
Err(anyhow::anyhow!(
283+
"failed to {} {}: {}",
284+
built.method(),
285+
built.url(),
286+
e,
287+
))
288+
}
276289
}
277290
}
278291
}

0 commit comments

Comments
 (0)