satyarohith / sift

Sift is a routing and utility library for Deno Deploy.

Home Page:https://deno.land/x/sift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

serveStatic() doesn't use the 404 handler when the file is missing

innovatedev-john-pope opened this issue · comments

With these routes:

{
  "/:filename+": serveStatic("public", { baseUrl: import.meta.url }),
  404: () => new Response("not found", { status: 404 }),
}

If I try going to a file that doesn't exist, it causes a 500 error and the response has an error message containing the file path, not the 404:

{"error":"No such file or directory (os error 2), open '/var/www/deno/public/missing.png'"}

Using the intervene option doesn't work either as the error is thrown before the intervene function is called.