diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs index 6efceda11e..469e3e51d6 100644 --- a/ext/cache/sqlite.rs +++ b/ext/cache/sqlite.rs @@ -8,6 +8,7 @@ use std::time::SystemTime; use std::time::UNIX_EPOCH; use async_trait::async_trait; +use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::futures::future::poll_fn; use deno_core::parking_lot::Mutex; @@ -45,7 +46,13 @@ impl SqliteBackedCache { pub fn new(cache_storage_dir: PathBuf) -> Result { { std::fs::create_dir_all(&cache_storage_dir) - .expect("failed to create cache dir"); + .with_context(|| { + format!( + "Failed to create cache storage directory {}", + cache_storage_dir.display() + ) + }) + .map_err(CacheError::Other)?; let path = cache_storage_dir.join("cache_metadata.db"); let connection = rusqlite::Connection::open(&path).unwrap_or_else(|_| { panic!("failed to open cache db at {}", path.display())