SEBSERV-450 better error handling
This commit is contained in:
parent
6281634a46
commit
ae1561a51a
5 changed files with 13 additions and 5 deletions
|
@ -141,7 +141,7 @@ public final class Result<T> {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -180,7 +180,7 @@ public abstract class RestCall<T> {
|
|||
e,
|
||||
"NO RESPONSE AVAILABLE",
|
||||
String.valueOf(builder)));
|
||||
return Result.ofError(e);
|
||||
return Result.ofError(restCallError);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,10 @@ public abstract class RestCall<T> {
|
|||
} 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(
|
||||
|
|
|
@ -63,7 +63,8 @@ public class MockCourseAccessAPI implements CourseAccessAPI {
|
|||
"quiz1", institutionId, lmsSetupId, lmsType, "Demo Quiz 1 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
|
||||
"2020-01-01T09:00:00Z", null, "http://lms.mockup.com/api/"));
|
||||
this.mockups.add(new QuizData(
|
||||
"quiz2", institutionId, lmsSetupId, lmsType, "Demo Quiz 2 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
|
||||
"quiz2", institutionId, lmsSetupId, lmsType, "Demo Quiz 2 (MOCKUP) &sd;+1 äöüèÜÄÖ ?<",
|
||||
"<p>Demo Quiz Mockup &sd;+1 äöüèÜÄÖ ?<</p>",
|
||||
"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)", "<p>Demo Quiz Mockup</p>",
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue