From fe51c2d1ecb40702a4b944d3b3a717015c18f31a Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Sun, 30 Mar 2025 17:00:55 +0200 Subject: [PATCH] fix: correcte error handling in question controller backend --- backend/src/controllers/questions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/controllers/questions.ts b/backend/src/controllers/questions.ts index 00a51329..217994f6 100644 --- a/backend/src/controllers/questions.ts +++ b/backend/src/controllers/questions.ts @@ -106,13 +106,14 @@ export async function deleteQuestionHandler(req: Request, res: Response): Promis const questionId = getQuestionId(req, res); if (!questionId) { + res.json(404).json({ error: 'Question not found' }); return; } const question = await deleteQuestion(questionId); if (!question) { - res.status(400).json({ error: 'Could not find nor delete question' }); + res.status(404).json({ error: 'Could not find nor delete question' }); } else { res.json(question); }