diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java index 41acee38..9d1f238d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java @@ -141,7 +141,7 @@ public final class Result { if (this.error instanceof RuntimeException) { throw (RuntimeException) this.error; } else { - throw new RuntimeException("RuntimeExceptionWrapper cause: ", this.error); + throw new RuntimeException("RuntimeExceptionWrapper cause: " + this.error.getMessage(), this.error); } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageAction.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageAction.java index 1c78953e..03149686 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageAction.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageAction.java @@ -185,6 +185,9 @@ public final class PageAction { } catch (final PageMessageException pme) { PageAction.this.pageContext.publishPageMessage(pme); return; + } catch (final Exception e) { + this.pageContext.notifyUnexpectedError(e); + return; } } else { callback.accept(exec()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java index 8f1dd4c2..483e48cf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCall.java @@ -180,7 +180,7 @@ public abstract class RestCall { e, "NO RESPONSE AVAILABLE", String.valueOf(builder))); - return Result.ofError(e); + return Result.ofError(restCallError); } } @@ -216,6 +216,10 @@ public abstract class RestCall { } else { restCallError.errors.add(APIMessage.ErrorMessage.GENERIC.of(responseEntity.getBody())); } + } catch (final Exception e) { + final String body = responseEntity.getBody(); + log.error("Failed to parse rest response error message: {}", body); + throw e; } log.debug( diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java index c8bf545a..0b44709a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java @@ -63,7 +63,8 @@ public class MockCourseAccessAPI implements CourseAccessAPI { "quiz1", institutionId, lmsSetupId, lmsType, "Demo Quiz 1 (MOCKUP)", "

Demo Quiz Mockup

", "2020-01-01T09:00:00Z", null, "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( - "quiz2", institutionId, lmsSetupId, lmsType, "Demo Quiz 2 (MOCKUP)", "

Demo Quiz Mockup

", + "quiz2", institutionId, lmsSetupId, lmsType, "Demo Quiz 2 (MOCKUP) &sd;+1 äöüèÜÄÖ ?<", + "

Demo Quiz Mockup &sd;+1 äöüèÜÄÖ ?<

", "2020-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz3", institutionId, lmsSetupId, lmsType, "Demo Quiz 3 (MOCKUP)", "

Demo Quiz Mockup

", diff --git a/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java b/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java index 6d62f73d..e8d72124 100644 --- a/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java @@ -1578,7 +1578,7 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest { fail("Exception expected here"); } catch (final Exception e) { - assertEquals("argument \"content\" is null", e.getMessage()); + assertEquals("Unexpected error while rest call", e.getMessage()); } // test follow-up integrity violation @@ -1596,7 +1596,7 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest { fail("Exception expected here"); } catch (final Exception e) { - assertEquals("argument \"content\" is null", e.getMessage()); + assertEquals("Unexpected error while rest call", e.getMessage()); } final ConfigurationTableValues newTableValue = new ConfigurationTableValues(