From 5cb354fd18e2a06ffc55910ceb0c1d1f284bf1f7 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Wed, 1 Sep 2010 09:29:24 +0200 Subject: KerneloopsReporer: throw when missing bt Signed-off-by: Nikola Pajkovsky --- lib/plugins/KerneloopsReporter.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/plugins/KerneloopsReporter.cpp') diff --git a/lib/plugins/KerneloopsReporter.cpp b/lib/plugins/KerneloopsReporter.cpp index cee1bad7..edb333b0 100644 --- a/lib/plugins/KerneloopsReporter.cpp +++ b/lib/plugins/KerneloopsReporter.cpp @@ -90,24 +90,24 @@ std::string CKerneloopsReporter::Report(const map_crash_data_t& pCrashData, const map_plugin_settings_t& pSettings, const char *pArgs) { - CURLcode ret; + CURLcode ret = CURLE_OK; update_client(_("Creating and submitting a report...")); map_crash_data_t::const_iterator it = pCrashData.find(FILENAME_BACKTRACE); - if (it != pCrashData.end()) + if (it == pCrashData.end()) + throw CABRTException(EXCEP_PLUGIN, "Error sending kernel oops due to missing backtrace"); + + ret = http_post_to_kerneloops_site( + m_sSubmitURL.c_str(), + it->second[CD_CONTENT].c_str() + ); + if (ret != CURLE_OK) { - ret = http_post_to_kerneloops_site( - m_sSubmitURL.c_str(), - it->second[CD_CONTENT].c_str() - ); - if (ret != CURLE_OK) - { - char* err_str = xasprintf("Kernel oops has not been sent due to %s", curl_easy_strerror(ret)); - CABRTException e(EXCEP_PLUGIN, err_str); - free(err_str); - throw e; - } + char* err_str = xasprintf("Kernel oops has not been sent due to %s", curl_easy_strerror(ret)); + CABRTException e(EXCEP_PLUGIN, err_str); + free(err_str); + throw e; } /* Server replies with: -- cgit