From e971f64f92c640d3ee634b01eeba7fbf056fdaac Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 28 Mar 2014 01:47:48 +0100 Subject: Catch all exception produced by a received message (irc or xmpp) --- src/irc/irc_client.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/irc/irc_client.cpp') diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 3737b91..884f214 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -93,7 +93,13 @@ void IrcClient::parse_in_buffer(const size_t) this->in_buf = this->in_buf.substr(pos + 2, std::string::npos); auto cb = irc_callbacks.find(message.command); if (cb != irc_callbacks.end()) - (this->*(cb->second))(message); + { + try { + (this->*(cb->second))(message); + } catch (const std::exception& e) { + log_error("Unhandled exception: " << e.what()); + } + } else log_info("No handler for command " << message.command); } -- cgit v1.2.3