From 267186d65e739c257041324f5e8f9a64300df763 Mon Sep 17 00:00:00 2001 From: Pablo Berganza <40573613+pablo-abc@users.noreply.github.com> Date: Tue, 22 Oct 2024 06:40:07 +0200 Subject: [PATCH] fix(serve-static): silence `NotFound` warning on Deno (#3542) fix(serve-static): silence `NotFound` warning on Deno --- src/adapter/deno/serve-static.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/adapter/deno/serve-static.ts b/src/adapter/deno/serve-static.ts index 33786b20..0a575dfe 100644 --- a/src/adapter/deno/serve-static.ts +++ b/src/adapter/deno/serve-static.ts @@ -4,7 +4,7 @@ import type { Env, MiddlewareHandler } from '../../types' // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore -const { open, lstatSync } = Deno +const { open, lstatSync, errors } = Deno export const serveStatic = ( options: ServeStaticOptions @@ -16,7 +16,9 @@ export const serveStatic = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any return file ? (file.readable as any) : null } catch (e) { - console.warn(`${e}`) + if (!(e instanceof errors.NotFound)) { + console.warn(`${e}`) + } } } const pathResolve = (path: string) => {