diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/engine.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index ed75394..b0456a3 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -2,7 +2,10 @@ #include "util/function.hpp" +#include <fmt/core.h> + #include <chrono> +#include <exception> #include <thread> #include <utility> @@ -30,7 +33,16 @@ void CLIGameEngine::start() noexcept auto game = _game_factory(_scene, _cursor_controller, _user_input_observer); - game->on_start(); + try + { + game->on_start(); + } + catch (const std::exception &error) + { + _scene->leave(); + fmt::print("Error: {}\n", error.what()); + return; + } std::atexit(normalize_lambda( [this, &game]() |