summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-01-13 15:17:14 +0100
committerNikola Pajkovsky <npajkovs@redhat.com>2010-01-13 15:17:14 +0100
commitfc99cb12f0205a24f5f592af837d73b1c1e59034 (patch)
treec45a7cf9f390d8d06c7c28846c06c2bb38efa430 /lib/Utils
parent169b31b87ba8f63b70946f2177fcf657e15a6e8c (diff)
parentd188c8f886ecca7f9e0ff02dfadee50cd917c74b (diff)
downloadabrt-fc99cb12f0205a24f5f592af837d73b1c1e59034.tar.gz
abrt-fc99cb12f0205a24f5f592af837d73b1c1e59034.tar.xz
abrt-fc99cb12f0205a24f5f592af837d73b1c1e59034.zip
Merge branch 'bugzilla'
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/abrt_xmlrpc.cpp16
-rw-r--r--lib/Utils/abrt_xmlrpc.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/Utils/abrt_xmlrpc.cpp b/lib/Utils/abrt_xmlrpc.cpp
index ae1d098e..e3a4648a 100644
--- a/lib/Utils/abrt_xmlrpc.cpp
+++ b/lib/Utils/abrt_xmlrpc.cpp
@@ -15,6 +15,16 @@ CURL* xcurl_easy_init()
return curl;
}
+#if 1
+void throw_xml_fault(xmlrpc_env *env)
+{
+ std::string errmsg = ssprintf("XML-RPC Fault: %s(%d)", env->fault_string, env->fault_code);
+ xmlrpc_env_clean(env); // this is needed ONLY if fault_occurred
+ xmlrpc_env_init(env); // just in case user catches ex and _continues_ to use env
+ error_msg("%s", errmsg.c_str()); // show error in daemon log
+ throw CABRTException(EXCEP_PLUGIN, errmsg.c_str());
+}
+#else
void throw_if_xml_fault_occurred(xmlrpc_env *env)
{
if (env->fault_occurred)
@@ -26,6 +36,7 @@ void throw_if_xml_fault_occurred(xmlrpc_env *env)
throw CABRTException(EXCEP_PLUGIN, errmsg.c_str());
}
}
+#endif
void abrt_xmlrpc_conn::new_xmlrpc_client(const char* url, bool no_ssl_verify)
{
@@ -60,15 +71,16 @@ void abrt_xmlrpc_conn::new_xmlrpc_client(const char* url, bool no_ssl_verify)
PACKAGE_NAME, VERSION,
&clientParms, XMLRPC_CPSIZE(transportparm_size),
&m_pClient);
- throw_if_xml_fault_occurred(&env);
+ if (env.fault_occurred)
+ throw_xml_fault(&env);
m_pServer_info = xmlrpc_server_info_new(&env, url);
if (env.fault_occurred)
{
xmlrpc_client_destroy(m_pClient);
m_pClient = NULL;
+ throw_xml_fault(&env);
}
- throw_if_xml_fault_occurred(&env);
}
void abrt_xmlrpc_conn::destroy_xmlrpc_client()
diff --git a/lib/Utils/abrt_xmlrpc.h b/lib/Utils/abrt_xmlrpc.h
index 352e80ca..a8bd2cca 100644
--- a/lib/Utils/abrt_xmlrpc.h
+++ b/lib/Utils/abrt_xmlrpc.h
@@ -24,7 +24,7 @@ struct abrt_xmlrpc_conn {
};
/* Utility functions */
-void throw_if_xml_fault_occurred(xmlrpc_env *env);
+void throw_xml_fault(xmlrpc_env *env);
CURL* xcurl_easy_init();
#endif