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

DojoBackendManager => Assignment/Exercise creation error enhancement

parent 4339ebba
Branches
Tags
No related merge requests found
Pipeline #26768 passed
......@@ -9,6 +9,7 @@ import DojoBackendResponse from '../shared/types/Dojo/DojoBackendResponse';
import Exercise from '../sharedByClients/models/Exercise';
import GitlabToken from '../shared/types/Gitlab/GitlabToken';
import User from '../sharedByClients/models/User';
import DojoStatusCode from '../shared/types/Dojo/DojoStatusCode';
class DojoBackendManager {
......@@ -106,7 +107,11 @@ class DojoBackendManager {
if ( error.response.status === StatusCodes.CONFLICT ) {
spinner.fail(`The assignment name is already used. Please choose another one.`);
} else {
spinner.fail(`Assignment creation error: ${ error.response.statusText }`);
if ( (error.response.data as DojoBackendResponse<any>).code === DojoStatusCode.ASSIGNMENT_CREATION_GITLAB_ERROR ) {
spinner.fail(`Assignment creation error: An unknown error occurred while creating the assignment on Gitlab. Please try again later or contact an administrator.`);
} else {
spinner.fail(`Assignment creation error: An unknown error occurred while creating the assignment on Dojo server. Please try again later or contact an administrator.`);
}
}
}
} else {
......@@ -140,7 +145,11 @@ class DojoBackendManager {
if ( error.response.status === StatusCodes.CONFLICT ) {
spinner.fail(`You've already reached the max number of exercise of this assignment.`);
} else {
spinner.fail(`Exercise creation error: ${ error.response.statusText }`);
if ( (error.response.data as DojoBackendResponse<any>).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.`);
} else {
spinner.fail(`Exercise creation error: An unknown error occurred while creating the exercise on Dojo server. Please try again later or contact an administrator.`);
}
}
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment