blob: 65a5533fcf654bb335e9347da943b94c8d2ab95b [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
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_ERROR_CODE_H__
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_ERROR_CODE_H__
7
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,
David Zeuthena99981f2013-04-29 13:42:47 -070056
57 // Note: When adding new error codes, please remember to add the
58 // error into one of the buckets in PayloadState::UpdateFailed method so
59 // that the retries across URLs and the payload backoff mechanism work
60 // correctly for those new error codes.
61
62 // Any code above this is sent to both Omaha and UMA as-is, except
63 // kErrorCodeOmahaErrorInHTTPResponse (see error code 2000 for more details).
64 // Codes/flags below this line is sent only to Omaha and not to UMA.
65
66 // kErrorCodeUmaReportedMax is not an error code per se, it's just the count
67 // of the number of enums above. Add any new errors above this line if you
68 // want them to show up on UMA. Stuff below this line will not be sent to UMA
69 // but is used for other errors that are sent to Omaha. We don't assign any
70 // particular value for this enum so that it's just one more than the last
71 // one above and thus always represents the correct count of UMA metrics
72 // buckets, even when new enums are added above this line in future. See
73 // utils::SendErrorCodeToUma on how this enum is used.
74 kErrorCodeUmaReportedMax,
75
76 // use the 2xxx range to encode HTTP errors. These errors are available in
77 // Dremel with the individual granularity. But for UMA purposes, all these
78 // errors are aggregated into one: kErrorCodeOmahaErrorInHTTPResponse.
79 kErrorCodeOmahaRequestHTTPResponseBase = 2000, // + HTTP response code
80
81 // TODO(jaysri): Move out all the bit masks into separate constants
82 // outside the enum as part of fixing bug 34369.
83 // Bit flags. Remember to update the mask below for new bits.
84
85 // Set if boot mode not normal.
86 kErrorCodeDevModeFlag = 1 << 31,
87
88 // Set if resuming an interruped update.
89 kErrorCodeResumedFlag = 1 << 30,
90
91 // Set if using a dev/test image as opposed to an MP-signed image.
92 kErrorCodeTestImageFlag = 1 << 29,
93
94 // Set if using devserver or Omaha sandbox (using crosh autest).
95 kErrorCodeTestOmahaUrlFlag = 1 << 28,
96
97 // Mask that indicates bit positions that are used to indicate special flags
98 // that are embedded in the error code to provide additional context about
99 // the system in which the error was encountered.
100 kErrorCodeSpecialFlags = (kErrorCodeDevModeFlag |
101 kErrorCodeResumedFlag |
102 kErrorCodeTestImageFlag |
103 kErrorCodeTestOmahaUrlFlag)
104};
105
106} // namespace chromeos_update_engine
107
108#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_ACTION_PROCESSOR_H__