Skip to content

Commit 5125eee

Browse files
authored
add handling of error status in beacon blob provider (#362)
1 parent 6dfe713 commit 5125eee

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

crates/providers/src/l1/blob/client.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,10 @@ impl BeaconClientProvider {
111111

112112
/// Returns the blobs for the provided slot.
113113
async fn blobs(&self, slot: u64) -> Result<Vec<BlobData>, reqwest::Error> {
114-
let raw_response = self
115-
.inner
116-
.get(format!("{}/{}/{}", self.base, Self::SIDECARS_METHOD_PREFIX, slot))
117-
.send()
118-
.await?;
119-
let raw_response = raw_response.json::<BeaconBlobBundle>().await?;
120-
121-
Ok(raw_response.data)
114+
let url = format!("{}/{}/{}", self.base, Self::SIDECARS_METHOD_PREFIX, slot);
115+
let response = self.inner.get(&url).send().await?.error_for_status()?;
116+
let blob_bundle = response.json::<BeaconBlobBundle>().await?;
117+
Ok(blob_bundle.data)
122118
}
123119

124120
/// Returns the beacon slot given a block timestamp.

0 commit comments

Comments
 (0)