refactor: use rr actions/loader

refactor: use rr actions
This commit is contained in:
Nicolas Meienberger
2025-08-31 19:22:55 +02:00
parent 23f47bbb6b
commit 37effcb4e3
21 changed files with 454 additions and 219 deletions

View File

@@ -1,8 +1,14 @@
import { ConflictError } from "http-errors-enhanced";
import { ConflictError, NotFoundError } from "http-errors-enhanced";
export const handleServiceError = (error: unknown) => {
if (error instanceof ConflictError) {
return { message: error.message, status: 409 as const };
}
if (error instanceof NotFoundError) {
return { message: error.message, status: 404 as const };
}
console.error("Unhandled service error:", error);
return { message: "Internal Server Error", status: 500 as const };
};