Client: catch errors when executing init commands

This commit is contained in:
Maxime Coste 2012-12-19 18:56:47 +01:00
parent 6c901e9152
commit 2ab9b474be

View File

@ -15,7 +15,22 @@ void ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
InputHandler* input_handler = &m_clients.back()->input_handler; InputHandler* input_handler = &m_clients.back()->input_handler;
Context* context = &m_clients.back()->context; 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) { EventManager::instance().watch(event_fd, [input_handler, context, this](int fd) {
try try
{ {