show error if core fails to initialize

dbus-notify
Zlatin Balevsky 2022-06-05 17:30:06 +01:00
parent eb38aa0d21
commit 6f0a73d995
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 11 additions and 3 deletions

View File

@ -116,20 +116,28 @@ class Ready extends AbstractLifecycleHandler {
core.eventBus.publish(new UILoadedEvent())
def initer = {
core.startServices()
try {
core.startServices()
} catch (Exception bad) {
log.log(Level.SEVERE, "couldn't start core", bad)
fatalShutdown(props)
}
} as Runnable
initer = new Thread(initer, "core initializer")
initer.setDaemon(true)
initer.start()
} catch (Exception bad) {
log.log(Level.SEVERE,"couldn't initialize core",bad)
fatalShutdown(props)
}
}
private void fatalShutdown(MuWireSettings props) {
String key = props.embeddedRouter ? "CORE_INIT_ERROR_BODY_EMBEDDED" : "CORE_INIT_ERROR_BODY_EXTERNAL"
JOptionPane.showMessageDialog(null, trans(key),
trans("CORE_INIT_ERROR_HEADER"), JOptionPane.WARNING_MESSAGE)
application.shutdown()
}
}
}