Update index.ts

This commit is contained in:
2025-10-25 22:17:41 +08:00
parent e9c364ba7a
commit cb36ee118d
+2 -2
View File
@@ -23,7 +23,7 @@ class HttpError extends Error {
super() super()
} }
} }
function done(status: number, content: string | object) { function done(status: number, content: string | object): never {
throw new HttpError(status, content) throw new HttpError(status, content)
} }
@@ -175,7 +175,7 @@ export const app = new Elysia()
const photo = metadata.find((p) => p.id === id) const photo = metadata.find((p) => p.id === id)
// Not found or hidden // Not found or hidden
if (!photo || photo.hide === true) throw done(404, "Photo not found") if (!photo || photo.hide === true) done(404, "Photo not found")
const file = Bun.file(photo.edited_photo.path) const file = Bun.file(photo.edited_photo.path)
if (!(await file.exists())) { if (!(await file.exists())) {