Skip to content

Commit

Permalink
fix: catch new NotFound errors thrown by Deno.stat
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorten committed Oct 29, 2021
1 parent ae343a6 commit 44bda92
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ export function sendError(res: Response, error?: any): void {
);
} else if (ENOENT_REGEXP.test(error.message)) {
throw createError(create404Error(), { code: "ENOENT" });
} else if (error instanceof Deno.errors.NotFound) {
throw createError(create404Error(), { code: "ENOENT" });
} else if (ENAMETOOLONG_REGEXP.test(error.message)) {
throw createError(create404Error(), { code: "ENAMETOOLONG" });
} else if (error.status === 404 || error.statusCode === 404) {
Expand Down

0 comments on commit 44bda92

Please sign in to comment.