From 2ab9b474beadcb6b7a53bd15856ff91ec26fa575 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 19 Dec 2012 18:56:47 +0100 Subject: [PATCH] Client: catch errors when executing init commands --- src/client_manager.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/client_manager.cc b/src/client_manager.cc index 6cb5cd75..cf9a02a6 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -15,7 +15,22 @@ void ClientManager::create_client(std::unique_ptr&& ui, InputHandler* input_handler = &m_clients.back()->input_handler; Context* context = &m_clients.back()->context; - CommandManager::instance().execute(init_commands, *context); + + try + { + CommandManager::instance().execute(init_commands, *context); + } + catch (Kakoune::runtime_error& error) + { + context->print_status(error.description()); + } + catch (Kakoune::client_removed&) + { + m_clients.pop_back(); + close(event_fd); + return; + } + EventManager::instance().watch(event_fd, [input_handler, context, this](int fd) { try {