Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: omaha_request_action.cc

Issue 4432002: AU: Separate error codes for different OmahaRequestAction failures. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mock_http_fetcher.cc ('k') | omaha_request_action_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: omaha_request_action.cc
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index ecee25eb958f32b5c6332cda03230d4ffdce4db6..51663150e8d647a3caff5723cdb155d3ec63f647 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -329,6 +329,13 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
if (!successful) {
LOG(ERROR) << "Omaha request network transfer failed.";
+ int code = GetHTTPResponseCode();
+ // Makes sure we send sane error values.
+ if (code < 0 || code >= 1000) {
+ code = 999;
+ }
+ completer.set_code(static_cast<ActionExitCode>(
+ kActionCodeOmahaRequestHTTPResponseBase + code));
return;
}
if (!HasOutputPipe()) {
@@ -343,6 +350,9 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
xmlParseMemory(&response_buffer_[0], response_buffer_.size()));
if (!doc.get()) {
LOG(ERROR) << "Omaha response not valid XML";
+ completer.set_code(response_buffer_.empty() ?
+ kActionCodeOmahaRequestEmptyResponseError :
+ kActionCodeOmahaRequestXMLParseError);
return;
}
@@ -366,6 +376,7 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
ConstXMLStr(kNamespace),
ConstXMLStr(kNsUrl)));
if (!xpath_nodeset.get()) {
+ completer.set_code(kActionCodeOmahaRequestNoUpdateCheckNode);
return;
}
xmlNodeSet* nodeset = xpath_nodeset->nodesetval;
@@ -376,6 +387,7 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
// get status
if (!xmlHasProp(updatecheck_node, ConstXMLStr("status"))) {
LOG(ERROR) << "Response missing status";
+ completer.set_code(kActionCodeOmahaRequestNoUpdateCheckStatus);
return;
}
@@ -393,6 +405,7 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
if (status != "ok") {
LOG(ERROR) << "Unknown status: " << status;
+ completer.set_code(kActionCodeOmahaRequestBadUpdateCheckStatus);
return;
}
« no previous file with comments | « mock_http_fetcher.cc ('k') | omaha_request_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698