core: Improve handling of core initialization errors
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 15 Jul 2018 21:48:32 +0000 (23:48 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 17 Jul 2018 17:58:05 +0000 (19:58 +0200)
commitf88bfa81380ceb2c4afce5b15f753570a1ef063d
tree235df37407085e7306010c923e8ad9e123a21749
parentb3b83bb123fb3087eba7147539ec0e7a34c6258b
core: Improve handling of core initialization errors

Since the event loop may not be running while the core is being
initialized, calling exit() does not have the desired effect.
Instead, throw an exception with exit code and error message to
be able to handle this correctly. Exceptions must not be thrown
through the event loop, so ensure that they're caught before in
cases where the event loop was started already.

For the monolithic client, introduce an asynchronous init method
that catches potential exceptions and calls exit() instead. Show
an error popup in the UI if an error message is provided, so the
user gets some feedback before the client is terminated.
14 files changed:
src/client/client.cpp
src/client/client.h
src/common/main.cpp
src/common/types.h
src/core/core.cpp
src/core/core.h
src/core/coreapplication.cpp
src/core/coreapplication.h
src/qtui/mainwin.cpp
src/qtui/mainwin.h
src/qtui/monoapplication.cpp
src/qtui/monoapplication.h
src/qtui/qtuiapplication.cpp
src/qtui/qtuiapplication.h