Skip to content
Snippets Groups Projects
Commit 5108073c authored by michael.minelli's avatar michael.minelli
Browse files

ExerciseCreate => Manage the MAX_EXERCISE_PER_ASSIGNMENT_REACHED error

parent 3d923e19
No related branches found
No related tags found
No related merge requests found
Pipeline #29073 passed
...@@ -142,8 +142,12 @@ class DojoBackendManager { ...@@ -142,8 +142,12 @@ class DojoBackendManager {
if ( verbose ) { if ( verbose ) {
if ( error instanceof AxiosError ) { if ( error instanceof AxiosError ) {
if ( error.response ) { if ( error.response ) {
if ( error.response.status === StatusCodes.CONFLICT ) { if ( error.response.status === StatusCodes.INSUFFICIENT_SPACE_ON_RESOURCE ) {
spinner.fail(`You've already reached the max number of exercise of this assignment.`); if ( error.response.data && (error.response.data as DojoBackendResponse<Array<GitlabUser>>).code === DojoStatusCode.MAX_EXERCISE_PER_ASSIGNMENT_REACHED ) {
spinner.fail(`The following users have reached the maximum number of exercise of this assignment : ${ ((error.response.data as DojoBackendResponse<Array<GitlabUser>>).data as Array<GitlabUser>).map(user => user.name).join(', ') }.`);
} else {
spinner.fail(`You've already reached the max number of exercise of this assignment.`);
}
} else { } else {
if ( (error.response.data as DojoBackendResponse<unknown>).code === DojoStatusCode.EXERCISE_CREATION_GITLAB_ERROR ) { if ( (error.response.data as DojoBackendResponse<unknown>).code === DojoStatusCode.EXERCISE_CREATION_GITLAB_ERROR ) {
spinner.fail(`Exercise creation error: An unknown error occurred while creating the exercise on Gitlab. Please try again later or contact an administrator.`); spinner.fail(`Exercise creation error: An unknown error occurred while creating the exercise on Gitlab. Please try again later or contact an administrator.`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment