diff options
Diffstat (limited to 'ext/cache/lib.rs')
-rw-r--r-- | ext/cache/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs index b9cc5427c..524d4cea0 100644 --- a/ext/cache/lib.rs +++ b/ext/cache/lib.rs @@ -33,7 +33,9 @@ pub enum CacheError { } #[derive(Clone)] -pub struct CreateCache<C: Cache + 'static>(pub Arc<dyn Fn() -> C>); +pub struct CreateCache<C: Cache + 'static>( + pub Arc<dyn Fn() -> Result<C, CacheError>>, +); deno_core::extension!(deno_cache, deps = [ deno_webidl, deno_web, deno_url, deno_fetch ], @@ -231,7 +233,7 @@ where if let Some(cache) = state.try_borrow::<CA>() { Ok(cache.clone()) } else if let Some(create_cache) = state.try_borrow::<CreateCache<CA>>() { - let cache = create_cache.0(); + let cache = create_cache.0()?; state.put(cache); Ok(state.borrow::<CA>().clone()) } else { |