fix: change to DashboardError

This commit is contained in:
abiyasa05 2024-08-18 19:06:22 +07:00
parent fdeca88270
commit 7daee35fee

View File

@ -11,6 +11,7 @@ import authInfo from "../../middlewares/authInfo";
import { or, eq } from "drizzle-orm";
import { z } from "zod";
import HonoEnv from "../../types/HonoEnv";
import { notFound } from "../../errors/DashboardError";
const registerFormSchema = z.object({
name: z.string().min(1).max(255),
@ -109,9 +110,7 @@ const respondentsRoute = new Hono<HonoEnv>()
.where(eq(rolesSchema.code, "user"))
.limit(1);
if (!role) {
throw new HTTPException(500, { message: "Role 'user' not found" });
}
if (!role) throw notFound();
await trx.insert(rolesToUsers).values({
userId: newUser.id,