log error messages, if startup fails

This commit is contained in:
Sebastian Sdorra
2019-12-04 10:48:34 +01:00
parent 6f535f9577
commit d70948a650

View File

@@ -88,14 +88,16 @@ public class BootstrapContextListener extends GuiceServletContextListener {
protected Injector getInjector() { protected Injector getInjector() {
Throwable startupError = SCMContext.getContext().getStartupError(); Throwable startupError = SCMContext.getContext().getStartupError();
if (startupError != null) { if (startupError != null) {
LOG.error("received unrecoverable error during startup", startupError);
return createStageOneInjector(SingleView.error(startupError)); return createStageOneInjector(SingleView.error(startupError));
} else if (Versions.isTooOld()) { } else if (Versions.isTooOld()) {
LOG.error("Existing version is too old and cannot be migrated to new version. Please update to version {} first", Versions.MIN_VERSION); LOG.error("existing version is too old and cannot be migrated to new version. Please update to version {} first", Versions.MIN_VERSION);
return createStageOneInjector(SingleView.view("/templates/too-old.mustache", HttpServletResponse.SC_CONFLICT)); return createStageOneInjector(SingleView.view("/templates/too-old.mustache", HttpServletResponse.SC_CONFLICT));
} else { } else {
try { try {
return createStageTwoInjector(); return createStageTwoInjector();
} catch (Exception ex) { } catch (Exception ex) {
LOG.error("failed to create stage two injector", ex);
return createStageOneInjector(SingleView.error(ex)); return createStageOneInjector(SingleView.error(ex));
} }
} }