aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--edify/expr.cpp9
-rw-r--r--edify/expr.h38
-rw-r--r--error_code.h6
-rw-r--r--updater/updater.cpp1
4 files changed, 28 insertions, 26 deletions
diff --git a/edify/expr.cpp b/edify/expr.cpp
index 54ab3325..403162d6 100644
--- a/edify/expr.cpp
+++ b/edify/expr.cpp
@@ -31,6 +31,8 @@
31#include <android-base/stringprintf.h> 31#include <android-base/stringprintf.h>
32#include <android-base/strings.h> 32#include <android-base/strings.h>
33 33
34#include "error_code.h"
35
34// Functions should: 36// Functions should:
35// 37//
36// - return a malloc()'d string 38// - return a malloc()'d string
@@ -416,8 +418,5 @@ Value* ErrorAbort(State* state, CauseCode cause_code, const char* format, ...) {
416 return nullptr; 418 return nullptr;
417} 419}
418 420
419State::State(const std::string& script, void* cookie) : 421State::State(const std::string& script, void* cookie)
420 script(script), 422 : script(script), cookie(cookie), error_code(kNoError), cause_code(kNoCause) {}
421 cookie(cookie) {
422}
423
diff --git a/edify/expr.h b/edify/expr.h
index 4838d20c..32828028 100644
--- a/edify/expr.h
+++ b/edify/expr.h
@@ -23,32 +23,34 @@
23#include <string> 23#include <string>
24#include <vector> 24#include <vector>
25 25
26#include "error_code.h" 26// Forward declaration to avoid including "error_code.h".
27enum ErrorCode : int;
28enum CauseCode : int;
27 29
28struct State { 30struct State {
29 State(const std::string& script, void* cookie); 31 State(const std::string& script, void* cookie);
30 32
31 // The source of the original script. 33 // The source of the original script.
32 const std::string& script; 34 const std::string& script;
33 35
34 // Optional pointer to app-specific data; the core of edify never 36 // Optional pointer to app-specific data; the core of edify never
35 // uses this value. 37 // uses this value.
36 void* cookie; 38 void* cookie;
37 39
38 // The error message (if any) returned if the evaluation aborts. 40 // The error message (if any) returned if the evaluation aborts.
39 // Should be empty initially, will be either empty or a string that 41 // Should be empty initially, will be either empty or a string that
40 // Evaluate() returns. 42 // Evaluate() returns.
41 std::string errmsg; 43 std::string errmsg;
42 44
43 // error code indicates the type of failure (e.g. failure to update system image) 45 // error code indicates the type of failure (e.g. failure to update system image)
44 // during the OTA process. 46 // during the OTA process.
45 ErrorCode error_code = kNoError; 47 ErrorCode error_code;
46 48
47 // cause code provides more detailed reason of an OTA failure (e.g. fsync error) 49 // cause code provides more detailed reason of an OTA failure (e.g. fsync error)
48 // in addition to the error code. 50 // in addition to the error code.
49 CauseCode cause_code = kNoCause; 51 CauseCode cause_code;
50 52
51 bool is_retry = false; 53 bool is_retry = false;
52}; 54};
53 55
54enum ValueType { 56enum ValueType {
diff --git a/error_code.h b/error_code.h
index 4e3032bc..26b9bb40 100644
--- a/error_code.h
+++ b/error_code.h
@@ -17,7 +17,7 @@
17#ifndef _ERROR_CODE_H_ 17#ifndef _ERROR_CODE_H_
18#define _ERROR_CODE_H_ 18#define _ERROR_CODE_H_
19 19
20enum ErrorCode { 20enum ErrorCode : int {
21 kNoError = -1, 21 kNoError = -1,
22 kLowBattery = 20, 22 kLowBattery = 20,
23 kZipVerificationFailure, 23 kZipVerificationFailure,
@@ -30,7 +30,7 @@ enum ErrorCode {
30 kUpdateBinaryCommandFailure, 30 kUpdateBinaryCommandFailure,
31}; 31};
32 32
33enum CauseCode { 33enum CauseCode : int {
34 kNoCause = -1, 34 kNoCause = -1,
35 kArgsParsingFailure = 100, 35 kArgsParsingFailure = 100,
36 kStashCreationFailure, 36 kStashCreationFailure,
@@ -51,7 +51,7 @@ enum CauseCode {
51 kVendorFailure = 200 51 kVendorFailure = 200
52}; 52};
53 53
54enum UncryptErrorCode { 54enum UncryptErrorCode : int {
55 kUncryptNoError = -1, 55 kUncryptNoError = -1,
56 kUncryptErrorPlaceholder = 50, 56 kUncryptErrorPlaceholder = 50,
57 kUncryptTimeoutError = 100, 57 kUncryptTimeoutError = 100,
diff --git a/updater/updater.cpp b/updater/updater.cpp
index e10174f7..309c309a 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -31,6 +31,7 @@
31#include <ziparchive/zip_archive.h> 31#include <ziparchive/zip_archive.h>
32 32
33#include "edify/expr.h" 33#include "edify/expr.h"
34#include "error_code.h"
34#include "otafault/config.h" 35#include "otafault/config.h"
35#include "otautil/DirUtil.h" 36#include "otautil/DirUtil.h"
36#include "otautil/SysUtil.h" 37#include "otautil/SysUtil.h"