diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java index 293c039e..1f6c4e79 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/JitsiProctoringService.java @@ -150,11 +150,17 @@ public class JitsiProctoringService implements ExamProctoringService { final ResponseEntity result = restTemplate.getForEntity(proctoringSettings.serverURL, String.class); if (result.getStatusCode() != HttpStatus.OK) { - throw new APIMessageException(APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR); + throw new APIMessageException(Arrays.asList( + APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL, + "proctoringSettings:serverURL:url.invalid"), + APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); } } catch (final Exception e) { log.error("Failed to access proctoring service: {}", e.getMessage()); - throw new APIMessageException(APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR, e.getMessage()); + throw new APIMessageException(Arrays.asList( + APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL, + "proctoringSettings:serverURL:url.invalid"), + APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of(e))); } return true; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java index 690f25d2..02afee6a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomProctoringService.java @@ -186,14 +186,17 @@ public class ZoomProctoringService implements ExamProctoringService { credentials); if (result.getStatusCode() != HttpStatus.OK) { - throw new APIMessageException( - APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR, - String.valueOf(result.getStatusCode())); + throw new APIMessageException(Arrays.asList( + APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL, + "proctoringSettings:serverURL:url.invalid"), + APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); } - } catch (final Exception e) { log.error("Failed to access Zoom service at: {}", proctoringSettings.serverURL, e); - throw new APIMessageException(APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR, e.getMessage()); + throw new APIMessageException(Arrays.asList( + APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL, + "proctoringSettings:serverURL:url.invalid"), + APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of())); } return true; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java index ec38c0f0..07985834 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java @@ -379,9 +379,11 @@ public class ExamAdministrationController extends EntityController { return this.entityDAO.byPK(examId) .flatMap(this.authorization::checkModify) .map(exam -> { - this.examAdminService.getExamProctoringService(proctoringServiceSettings.serverType) - .flatMap(service -> service.testExamProctoring(proctoringServiceSettings)) - .getOrThrow(); + if (proctoringServiceSettings.enableProctoring) { + this.examAdminService.getExamProctoringService(proctoringServiceSettings.serverType) + .flatMap(service -> service.testExamProctoring(proctoringServiceSettings)) + .getOrThrow(); + } this.examAdminService.saveProctoringServiceSettings(examId, proctoringServiceSettings); return exam; })