fix: revise throw error
This commit is contained in:
parent
f9d7e0398d
commit
c2ae3ec0e3
|
|
@ -147,10 +147,7 @@ const questionsRoute = new Hono<HonoEnv>()
|
|||
)
|
||||
);
|
||||
|
||||
if (!queryResult.length)
|
||||
throw new HTTPException(404, {
|
||||
message: "The question does not exists",
|
||||
});
|
||||
if (!queryResult[0]) throw notFound();
|
||||
|
||||
const questionData = {
|
||||
...queryResult[0],
|
||||
|
|
@ -256,10 +253,7 @@ const questionsRoute = new Hono<HonoEnv>()
|
|||
)
|
||||
);
|
||||
|
||||
if (!question[0])
|
||||
throw new HTTPException(404, {
|
||||
message: "The question is not found",
|
||||
});
|
||||
if (!question[0]) throw notFound();
|
||||
|
||||
if (skipTrash) {
|
||||
await db.delete(questions).where(eq(questions.id, questionId));
|
||||
|
|
@ -291,7 +285,7 @@ const questionsRoute = new Hono<HonoEnv>()
|
|||
await db.select().from(questions).where(eq(questions.id, questionId))
|
||||
)[0];
|
||||
|
||||
if (!question) return c.notFound();
|
||||
if (!question) throw notFound();
|
||||
|
||||
if (!question.deletedAt) {
|
||||
throw new HTTPException(400, {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user