mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
refactor: use rr actions/loader
refactor: use rr actions
This commit is contained in:
@@ -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 };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user