Skip to content

Commit

Permalink
fix(serve-static): silence NotFound warning on Deno (#3542)
Browse files Browse the repository at this point in the history
fix(serve-static): silence `NotFound` warning on Deno
  • Loading branch information
pablo-abc authored Oct 22, 2024
1 parent 15938b4 commit 267186d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/adapter/deno/serve-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <E extends Env = Env>(
options: ServeStaticOptions<E>
Expand All @@ -16,7 +16,9 @@ export const serveStatic = <E extends Env = Env>(
// 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) => {
Expand Down

0 comments on commit 267186d

Please sign in to comment.