void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
{
- Log(LogCritical, "db_ido_mysql", "Exception during database operation: " + DiagnosticInformation(exp));
+ Log(LogCritical, "db_ido_mysql", "Exception during database operation: '" + ErrorInformation(exp) + "'");
+ Log(LogDebug, "db_ido_mysql", "Exception during database operation: " + DiagnosticInformation(exp));
boost::mutex::scoped_lock lock(m_ConnectionMutex);
return boost::diagnostic_information(eptr);
}
+
+String icinga::ErrorInformation(boost::exception_ptr eptr)
+{
+ try {
+ boost::rethrow_exception(eptr);
+ } catch (const std::exception& ex) {
+ return ex.what();
+ }
+}
return result.str();
}
+template<typename T>
+String ErrorInformation(const T& ex)
+{
+ std::ostringstream result;
+
+ result << ex.what();
+
+ return result.str();
+}
+
I2_BASE_API String DiagnosticInformation(boost::exception_ptr eptr);
+I2_BASE_API String ErrorInformation(boost::exception_ptr eptr);
class I2_BASE_API posix_error : virtual public std::exception, virtual public boost::exception { };
Utility::QueueAsyncCallback(boost::bind(&ApiListener::NewClientHandler, this, client, RoleClient));
} catch (const std::exception& ex) {
std::ostringstream info, debug;
- info << "Cannot connect to host '" << node << "' on port '" << service << "'.";
+ info << "Cannot connect to host '" << node << "' on port '" << service << "'";
debug << info << std::endl << DiagnosticInformation(ex);
Log(LogCritical, "remote", info.str());
Log(LogDebug, "remote", debug.str());