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

Unified Diff: omaha_request_action.cc

Issue 3035007: Switch OmahaEvent's error_code to ActionExitCode. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: explicit single argument ctor Created 10 years, 5 months 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 | « omaha_request_action.h ('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 e801f408e9d2647f04d26e0c505837723f24c318..97c1ea998adfa5464da84b54577b2137a87574c6 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -69,10 +69,15 @@ string FormatRequest(const OmahaEvent* event,
" <o:ping active=\"0\"></o:ping>\n"
" <o:updatecheck></o:updatecheck>\n");
} else {
+ // The error code is an optional attribute so append it only if
+ // the result is not success.
+ string error_code;
+ if (event->result != OmahaEvent::kResultSuccess) {
+ error_code = StringPrintf(" errorcode=\"%d\"", event->error_code);
+ }
body = StringPrintf(
- " <o:event eventtype=\"%d\" eventresult=\"%d\" "
- "errorcode=\"%d\"></o:event>\n",
- event->type, event->result, event->error_code);
+ " <o:event eventtype=\"%d\" eventresult=\"%d\"%s></o:event>\n",
+ event->type, event->result, error_code.c_str());
}
return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" "
« no previous file with comments | « omaha_request_action.h ('k') | omaha_request_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698