From 3385d1252e4eae093234d0a075f4a564308ba48e Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:48:42 -0400 Subject: chore: forward v2.0.1 release commit to main (#26338) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the release commit being forwarded back to main for 2.0.1 Co-authored-by: bartlomieju Co-authored-by: Bartek Iwańczuk --- ext/cache/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index 9d876fcb7..d0f260d9c 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.103.0" +version = "0.104.0" authors.workspace = true edition.workspace = true license.workspace = true -- cgit v1.2.3 From ed13efc4ac3ed5262d025bd7228785553fecff1c Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Thu, 17 Oct 2024 09:43:04 -0700 Subject: refactor(ext/net): use concrete error type (#26227) --- ext/cache/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs index 08661c349..b9cc5427c 100644 --- a/ext/cache/lib.rs +++ b/ext/cache/lib.rs @@ -28,7 +28,7 @@ pub enum CacheError { Resource(deno_core::error::AnyError), #[error(transparent)] Other(deno_core::error::AnyError), - #[error(transparent)] + #[error("{0}")] Io(#[from] std::io::Error), } -- cgit v1.2.3 From 3ae10a01e0c8b9c425276a33b98f661c1473cd59 Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:12:49 -0400 Subject: chore: forward v2.0.2 release commit to main (#26376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the release commit being forwarded back to main for 2.0.2 Co-authored-by: bartlomieju Co-authored-by: Bartek Iwańczuk --- ext/cache/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index d0f260d9c..dee4d7274 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.104.0" +version = "0.105.0" authors.workspace = true edition.workspace = true license.workspace = true -- cgit v1.2.3 From 730331622ee17cf603447f4eb53631b9cfd7bef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 25 Oct 2024 14:57:40 +0100 Subject: chore: forward v2.0.3 commit to main (#26535) Forwarding v2.0.3 commit to `main` Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju --- ext/cache/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index dee4d7274..a07a8f720 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.105.0" +version = "0.106.0" authors.workspace = true edition.workspace = true license.workspace = true -- cgit v1.2.3 From a1473d82c5612676c50af00ded0467dbb29bc0a8 Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Wed, 30 Oct 2024 08:46:31 -0400 Subject: chore: forward v2.0.4 release commit to main (#26636) This is the release commit being forwarded back to main for 2.0.4 Co-authored-by: bartlomieju --- ext/cache/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index a07a8f720..7cae8d88a 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.106.0" +version = "0.107.0" authors.workspace = true edition.workspace = true license.workspace = true -- cgit v1.2.3 From ef7432c03f83ad9e9ca2812d0ab5653e87fa5259 Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:27:14 -0500 Subject: chore: forward v2.0.5 release commit to main (#26755) This is the release commit being forwarded back to main for 2.0.5 Co-authored-by: bartlomieju --- ext/cache/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index 7cae8d88a..20dc9ca48 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.107.0" +version = "0.108.0" authors.workspace = true edition.workspace = true license.workspace = true -- cgit v1.2.3 From 637b1d5508293ed02bef2f317b30bb7c1f0cbc71 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 8 Nov 2024 12:27:29 +0530 Subject: fix(ext/cache): don't panic when creating cache (#26780) --- ext/cache/lib.rs | 6 ++++-- ext/cache/sqlite.rs | 23 +++++++++-------------- 2 files changed, 13 insertions(+), 16 deletions(-) (limited to 'ext/cache') 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(pub Arc C>); +pub struct CreateCache( + pub Arc Result>, +); 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::() { Ok(cache.clone()) } else if let Some(create_cache) = state.try_borrow::>() { - let cache = create_cache.0(); + let cache = create_cache.0()?; state.put(cache); Ok(state.borrow::().clone()) } else { diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs index e4991c32f..6efceda11 100644 --- a/ext/cache/sqlite.rs +++ b/ext/cache/sqlite.rs @@ -42,7 +42,7 @@ pub struct SqliteBackedCache { } impl SqliteBackedCache { - pub fn new(cache_storage_dir: PathBuf) -> Self { + pub fn new(cache_storage_dir: PathBuf) -> Result { { std::fs::create_dir_all(&cache_storage_dir) .expect("failed to create cache dir"); @@ -57,18 +57,14 @@ impl SqliteBackedCache { PRAGMA synchronous=NORMAL; PRAGMA optimize; "; - connection - .execute_batch(initial_pragmas) - .expect("failed to execute pragmas"); - connection - .execute( - "CREATE TABLE IF NOT EXISTS cache_storage ( + connection.execute_batch(initial_pragmas)?; + connection.execute( + "CREATE TABLE IF NOT EXISTS cache_storage ( id INTEGER PRIMARY KEY, cache_name TEXT NOT NULL UNIQUE )", - (), - ) - .expect("failed to create cache_storage table"); + (), + )?; connection .execute( "CREATE TABLE IF NOT EXISTS request_response_list ( @@ -86,12 +82,11 @@ impl SqliteBackedCache { UNIQUE (cache_id, request_url) )", (), - ) - .expect("failed to create request_response_list table"); - SqliteBackedCache { + )?; + Ok(SqliteBackedCache { connection: Arc::new(Mutex::new(connection)), cache_storage_dir, - } + }) } } } -- cgit v1.2.3 From e1b40a69c0241a9be7249b64118eae8741e24268 Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Sun, 10 Nov 2024 02:42:18 -0500 Subject: chore: forward v2.0.6 release commit to main (#26804) This is the release commit being forwarded back to main for 2.0.6 Signed-off-by: Divy Srivastava Co-authored-by: Divy Srivastava --- ext/cache/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index 20dc9ca48..56fa0a527 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.108.0" +version = "0.109.0" authors.workspace = true edition.workspace = true license.workspace = true -- cgit v1.2.3 From 768c5ea2bb2a927455577a29f0761425593aea98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 16 Nov 2024 14:29:36 +0000 Subject: fix(ext/cache): gracefully error when cache creation failed (#26895) Removes panic reported in https://github.com/denoland/deno/issues/26893 --- ext/cache/sqlite.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ext/cache') diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs index 6efceda11..469e3e51d 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()) -- cgit v1.2.3