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