diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs
index f2a879e709..7c6e8b16ff 100644
--- a/ext/cache/lib.rs
+++ b/ext/cache/lib.rs
@@ -40,6 +40,9 @@ pub enum CacheError {
#[class(type)]
#[error("Cache deletion is not supported")]
DeletionNotSupported,
+ #[class(type)]
+ #[error("Content-Encoding is not allowed in response headers")]
+ ContentEncodingNotAllowed,
#[class(generic)]
#[error(transparent)]
Sqlite(#[from] rusqlite::Error),
@@ -68,6 +71,15 @@ pub enum CacheError {
#[source]
source: std::io::Error,
},
+ #[class(generic)]
+ #[error("cache {method} request failed: {status}")]
+ RequestFailed {
+ method: &'static str,
+ status: hyper::StatusCode,
+ },
+ #[class(generic)]
+ #[error("{0}")]
+ Reqwest(#[from] reqwest::Error),
}
#[derive(Clone)]
diff --git a/ext/cache/lsc_shard.rs b/ext/cache/lsc_shard.rs
index ac63131c74..7a3df607a0 100644
--- a/ext/cache/lsc_shard.rs
+++ b/ext/cache/lsc_shard.rs
@@ -1,10 +1,11 @@
// Copyright 2018-2025 the Deno authors. MIT license.
-use anyhow::Context;
use hyper::header::AUTHORIZATION;
use hyper::HeaderMap;
use hyper::StatusCode;
+use crate::CacheError;
+
pub struct CacheShard {
client: reqwest::Client,
endpoint: String,
@@ -26,7 +27,7 @@ impl CacheShard {
pub async fn get_object(
&self,
object_key: &str,
- ) -> anyhow::Result