From 85aca0f7ebd4ee5fba22f059a09d61968f73fa91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <git@minelli.me> Date: Fri, 1 Mar 2024 16:06:56 +0100 Subject: [PATCH] AssignmentRoutes => Add special status code for assignment name conflict --- ExpressAPI/src/routes/AssignmentRoutes.ts | 6 +++--- ExpressAPI/src/shared | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ExpressAPI/src/routes/AssignmentRoutes.ts b/ExpressAPI/src/routes/AssignmentRoutes.ts index 2366880..9f46f49 100644 --- a/ExpressAPI/src/routes/AssignmentRoutes.ts +++ b/ExpressAPI/src/routes/AssignmentRoutes.ts @@ -99,13 +99,13 @@ class AssignmentRoutes implements RoutesManager { if ( error instanceof AxiosError ) { if ( error.response?.data.message.name && error.response.data.message.name === 'has already been taken' ) { - return res.status(StatusCodes.CONFLICT).send(); + return req.session.sendResponse(res, StatusCodes.CONFLICT, {}, `Repository name has already been take`, DojoStatusCode.ASSIGNMENT_NAME_CONFLICT); } - return res.status(error.response?.status ?? HttpStatusCode.InternalServerError).send(); + return req.session.sendResponse(res, error.response?.status ?? HttpStatusCode.InternalServerError); } - return res.status(StatusCodes.INTERNAL_SERVER_ERROR).send(); + return req.session.sendResponse(res, HttpStatusCode.InternalServerError); } await new Promise(resolve => setTimeout(resolve, Config.gitlab.repository.timeoutAfterCreation)); diff --git a/ExpressAPI/src/shared b/ExpressAPI/src/shared index 6214acb..1346565 160000 --- a/ExpressAPI/src/shared +++ b/ExpressAPI/src/shared @@ -1 +1 @@ -Subproject commit 6214acbd799d9eed3f5b6840858f8d5ecda82c86 +Subproject commit 1346565c5759be045a1347f82eea230d393e38cb -- GitLab