From dae1eee2da7bbd13b954affba85dc46ea4d58160 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 10 May 2026 11:43:33 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20handle=20unused=20error?= =?UTF-8?q?=20in=20fetchWithCache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added a warning log when Redis initialization fails and falls back to memory. - Suppressed the log in test environments to keep output clean. - Used eslint-disable comment to allow intentional console usage. Co-authored-by: suranig <24814104+suranig@users.noreply.github.com> --- src/cache/fetchWithCache.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cache/fetchWithCache.ts b/src/cache/fetchWithCache.ts index e4477b0..3ebb9e8 100644 --- a/src/cache/fetchWithCache.ts +++ b/src/cache/fetchWithCache.ts @@ -34,6 +34,13 @@ export function getDefaultHandler() { prefix: 'next-cachex', }); } catch (error) { + if (process.env.NODE_ENV !== 'test') { + // eslint-disable-next-line no-console + console.warn( + 'Failed to initialize Redis backend, falling back to memory:', + error instanceof Error ? error.message : String(error), + ); + } // Fallback to memory backend if Redis is not available (e.g., in tests) defaultHandler = createCacheHandler({ backend: new MemoryCacheBackend(),