blob: fc66ac9e74111f03aab4b29a7efaddeec22559dd [file] [log] [blame]
David Zeuthena99981f2013-04-29 13:42:47 -07001// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Alex Deymo759c2752014-03-17 21:09:36 -07005#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_ERROR_CODE_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_ERROR_CODE_H_
David Zeuthena99981f2013-04-29 13:42:47 -07007
8namespace chromeos_update_engine {
9
10// Action exit codes.
11enum ErrorCode {
12 kErrorCodeSuccess = 0,
13 kErrorCodeError = 1,
14 kErrorCodeOmahaRequestError = 2,
15 kErrorCodeOmahaResponseHandlerError = 3,
16 kErrorCodeFilesystemCopierError = 4,
17 kErrorCodePostinstallRunnerError = 5,
Gilad Arnold21504f02013-05-24 08:51:22 -070018 kErrorCodePayloadMismatchedType = 6,
David Zeuthena99981f2013-04-29 13:42:47 -070019 kErrorCodeInstallDeviceOpenError = 7,
20 kErrorCodeKernelDeviceOpenError = 8,
21 kErrorCodeDownloadTransferError = 9,
22 kErrorCodePayloadHashMismatchError = 10,
23 kErrorCodePayloadSizeMismatchError = 11,
24 kErrorCodeDownloadPayloadVerificationError = 12,
25 kErrorCodeDownloadNewPartitionInfoError = 13,
26 kErrorCodeDownloadWriteError = 14,
27 kErrorCodeNewRootfsVerificationError = 15,
28 kErrorCodeNewKernelVerificationError = 16,
29 kErrorCodeSignedDeltaPayloadExpectedError = 17,
30 kErrorCodeDownloadPayloadPubKeyVerificationError = 18,
31 kErrorCodePostinstallBootedFromFirmwareB = 19,
32 kErrorCodeDownloadStateInitializationError = 20,
33 kErrorCodeDownloadInvalidMetadataMagicString = 21,
34 kErrorCodeDownloadSignatureMissingInManifest = 22,
35 kErrorCodeDownloadManifestParseError = 23,
36 kErrorCodeDownloadMetadataSignatureError = 24,
37 kErrorCodeDownloadMetadataSignatureVerificationError = 25,
38 kErrorCodeDownloadMetadataSignatureMismatch = 26,
39 kErrorCodeDownloadOperationHashVerificationError = 27,
40 kErrorCodeDownloadOperationExecutionError = 28,
41 kErrorCodeDownloadOperationHashMismatch = 29,
42 kErrorCodeOmahaRequestEmptyResponseError = 30,
43 kErrorCodeOmahaRequestXMLParseError = 31,
44 kErrorCodeDownloadInvalidMetadataSize = 32,
45 kErrorCodeDownloadInvalidMetadataSignature = 33,
46 kErrorCodeOmahaResponseInvalid = 34,
47 kErrorCodeOmahaUpdateIgnoredPerPolicy = 35,
48 kErrorCodeOmahaUpdateDeferredPerPolicy = 36,
49 kErrorCodeOmahaErrorInHTTPResponse = 37,
50 kErrorCodeDownloadOperationHashMissingError = 38,
51 kErrorCodeDownloadMetadataSignatureMissingError = 39,
52 kErrorCodeOmahaUpdateDeferredForBackoff = 40,
53 kErrorCodePostinstallPowerwashError = 41,
54 kErrorCodeUpdateCanceledByChannelChange = 42,
Don Garrett81018e02013-07-30 18:46:31 -070055 kErrorCodePostinstallFirmwareRONotUpdatable = 43,
Don Garrett4d039442013-10-28 18:40:06 -070056 kErrorCodeUnsupportedMajorPayloadVersion = 44,
57 kErrorCodeUnsupportedMinorPayloadVersion = 45,
David Zeuthena99981f2013-04-29 13:42:47 -070058
Don Garrett4d039442013-10-28 18:40:06 -070059 // VERY IMPORTANT! When adding new error codes:
60 //
61 // 1) Update tools/metrics/histograms/histograms.xml in Chrome.
62 //
63 // 2) Update the assorted switch statements in update_engine which won't
64 // build until this case is added.
David Zeuthena99981f2013-04-29 13:42:47 -070065
66 // Any code above this is sent to both Omaha and UMA as-is, except
67 // kErrorCodeOmahaErrorInHTTPResponse (see error code 2000 for more details).
68 // Codes/flags below this line is sent only to Omaha and not to UMA.
69
70 // kErrorCodeUmaReportedMax is not an error code per se, it's just the count
71 // of the number of enums above. Add any new errors above this line if you
72 // want them to show up on UMA. Stuff below this line will not be sent to UMA
73 // but is used for other errors that are sent to Omaha. We don't assign any
74 // particular value for this enum so that it's just one more than the last
75 // one above and thus always represents the correct count of UMA metrics
76 // buckets, even when new enums are added above this line in future. See
77 // utils::SendErrorCodeToUma on how this enum is used.
78 kErrorCodeUmaReportedMax,
79
80 // use the 2xxx range to encode HTTP errors. These errors are available in
81 // Dremel with the individual granularity. But for UMA purposes, all these
82 // errors are aggregated into one: kErrorCodeOmahaErrorInHTTPResponse.
83 kErrorCodeOmahaRequestHTTPResponseBase = 2000, // + HTTP response code
84
85 // TODO(jaysri): Move out all the bit masks into separate constants
86 // outside the enum as part of fixing bug 34369.
87 // Bit flags. Remember to update the mask below for new bits.
88
89 // Set if boot mode not normal.
90 kErrorCodeDevModeFlag = 1 << 31,
91
92 // Set if resuming an interruped update.
93 kErrorCodeResumedFlag = 1 << 30,
94
95 // Set if using a dev/test image as opposed to an MP-signed image.
96 kErrorCodeTestImageFlag = 1 << 29,
97
98 // Set if using devserver or Omaha sandbox (using crosh autest).
99 kErrorCodeTestOmahaUrlFlag = 1 << 28,
100
101 // Mask that indicates bit positions that are used to indicate special flags
102 // that are embedded in the error code to provide additional context about
103 // the system in which the error was encountered.
104 kErrorCodeSpecialFlags = (kErrorCodeDevModeFlag |
105 kErrorCodeResumedFlag |
106 kErrorCodeTestImageFlag |
107 kErrorCodeTestOmahaUrlFlag)
108};
109
110} // namespace chromeos_update_engine
111
Alex Deymo759c2752014-03-17 21:09:36 -0700112#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_ERROR_CODE_H_