Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(serve-static): silence NotFound warning on Deno #3542

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { open, lstatSync } = Deno
const { open, lstatSync, errors } = Deno

Check warning on line 7 in src/adapter/deno/serve-static.ts

View check run for this annotation

Codecov / codecov/patch

src/adapter/deno/serve-static.ts#L7

Added line #L7 was not covered by tests

export const serveStatic = <E extends Env = Env>(
options: ServeStaticOptions<E>
Expand All @@ -16,7 +16,9 @@
// 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}`)
}

Check warning on line 21 in src/adapter/deno/serve-static.ts

View check run for this annotation

Codecov / codecov/patch

src/adapter/deno/serve-static.ts#L19-L21

Added lines #L19 - L21 were not covered by tests
}
}
const pathResolve = (path: string) => {
Expand Down
Loading