]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Common/BuildToolError.py
Sync BaseTool trunk (version r2649) into EDKII BaseTools.
[mirror_edk2.git] / BaseTools / Source / Python / Common / BuildToolError.py
1 ## @file
2 # Standardized Error Hanlding infrastructures.
3 #
4 # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
9 #
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 #
13
14 FILE_OPEN_FAILURE = 1
15 FILE_WRITE_FAILURE = 2
16 FILE_PARSE_FAILURE = 3
17 FILE_READ_FAILURE = 4
18 FILE_CREATE_FAILURE = 5
19 FILE_CHECKSUM_FAILURE = 6
20 FILE_COMPRESS_FAILURE = 7
21 FILE_DECOMPRESS_FAILURE = 8
22 FILE_MOVE_FAILURE = 9
23 FILE_DELETE_FAILURE = 10
24 FILE_COPY_FAILURE = 11
25 FILE_POSITIONING_FAILURE = 12
26 FILE_ALREADY_EXIST = 13
27 FILE_NOT_FOUND = 14
28 FILE_TYPE_MISMATCH = 15
29 FILE_CASE_MISMATCH = 16
30 FILE_DUPLICATED = 17
31 FILE_UNKNOWN_ERROR = 0x0FFF
32
33 OPTION_UNKNOWN = 0x1000
34 OPTION_MISSING = 0x1001
35 OPTION_CONFLICT = 0x1002
36 OPTION_VALUE_INVALID = 0x1003
37 OPTION_DEPRECATED = 0x1004
38 OPTION_NOT_SUPPORTED = 0x1005
39 OPTION_UNKNOWN_ERROR = 0x1FFF
40
41 PARAMETER_INVALID = 0x2000
42 PARAMETER_MISSING = 0x2001
43 PARAMETER_UNKNOWN_ERROR =0x2FFF
44
45 FORMAT_INVALID = 0x3000
46 FORMAT_NOT_SUPPORTED = 0x3001
47 FORMAT_UNKNOWN = 0x3002
48 FORMAT_UNKNOWN_ERROR = 0x3FFF
49
50 RESOURCE_NOT_AVAILABLE = 0x4000
51 RESOURCE_ALLOCATE_FAILURE = 0x4001
52 RESOURCE_FULL = 0x4002
53 RESOURCE_OVERFLOW = 0x4003
54 RESOURCE_UNDERRUN = 0x4004
55 RESOURCE_UNKNOWN_ERROR = 0x4FFF
56
57 ATTRIBUTE_NOT_AVAILABLE = 0x5000
58 ATTRIBUTE_GET_FAILURE = 0x5001
59 ATTRIBUTE_SET_FAILURE = 0x5002
60 ATTRIBUTE_UPDATE_FAILURE = 0x5003
61 ATTRIBUTE_ACCESS_DENIED = 0x5004
62 ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
63
64 IO_NOT_READY = 0x6000
65 IO_BUSY = 0x6001
66 IO_TIMEOUT = 0x6002
67 IO_UNKNOWN_ERROR = 0x6FFF
68
69 COMMAND_FAILURE = 0x7000
70
71 PERMISSION_FAILURE = 0x8000
72
73 CODE_ERROR = 0xC0DE
74
75 AUTOGEN_ERROR = 0xF000
76 PARSER_ERROR = 0xF001
77 BUILD_ERROR = 0xF002
78 GENFDS_ERROR = 0xF003
79 ECC_ERROR = 0xF004
80 EOT_ERROR = 0xF005
81 DDC_ERROR = 0xF009
82 WARNING_AS_ERROR = 0xF006
83 MIGRATION_ERROR = 0xF010
84 ABORT_ERROR = 0xFFFE
85 UNKNOWN_ERROR = 0xFFFF
86
87 ## Error message of each error code
88 gErrorMessage = {
89 FILE_NOT_FOUND : "File/directory not found in workspace",
90 FILE_OPEN_FAILURE : "File open failure",
91 FILE_WRITE_FAILURE : "File write failure",
92 FILE_PARSE_FAILURE : "File parse failure",
93 FILE_READ_FAILURE : "File read failure",
94 FILE_CREATE_FAILURE : "File create failure",
95 FILE_CHECKSUM_FAILURE : "Invalid checksum of file",
96 FILE_COMPRESS_FAILURE : "File compress failure",
97 FILE_DECOMPRESS_FAILURE : "File decompress failure",
98 FILE_MOVE_FAILURE : "File move failure",
99 FILE_DELETE_FAILURE : "File delete failure",
100 FILE_COPY_FAILURE : "File copy failure",
101 FILE_POSITIONING_FAILURE: "Failed to seeking position",
102 FILE_ALREADY_EXIST : "File or directory already exists",
103 FILE_TYPE_MISMATCH : "Incorrect file type",
104 FILE_CASE_MISMATCH : "File name case mismatch",
105 FILE_DUPLICATED : "Duplicated file found",
106 FILE_UNKNOWN_ERROR : "Unknown error encountered on file",
107
108 OPTION_UNKNOWN : "Unknown option",
109 OPTION_MISSING : "Missing option",
110 OPTION_CONFLICT : "Conflict options",
111 OPTION_VALUE_INVALID : "Invalid value of option",
112 OPTION_DEPRECATED : "Deprecated option",
113 OPTION_NOT_SUPPORTED : "Unsupported option",
114 OPTION_UNKNOWN_ERROR : "Unknown error when processing options",
115
116 PARAMETER_INVALID : "Invalid parameter",
117 PARAMETER_MISSING : "Missing parameter",
118 PARAMETER_UNKNOWN_ERROR : "Unknown error in parameters",
119
120 FORMAT_INVALID : "Invalid syntax/format",
121 FORMAT_NOT_SUPPORTED : "Not supported syntax/format",
122 FORMAT_UNKNOWN : "Unknown format",
123 FORMAT_UNKNOWN_ERROR : "Unknown error in syntax/format ",
124
125 RESOURCE_NOT_AVAILABLE : "Not available",
126 RESOURCE_ALLOCATE_FAILURE : "Allocate failure",
127 RESOURCE_FULL : "Full",
128 RESOURCE_OVERFLOW : "Overflow",
129 RESOURCE_UNDERRUN : "Underrun",
130 RESOURCE_UNKNOWN_ERROR : "Unknown error",
131
132 ATTRIBUTE_NOT_AVAILABLE : "Not available",
133 ATTRIBUTE_GET_FAILURE : "Failed to retrieve",
134 ATTRIBUTE_SET_FAILURE : "Failed to set",
135 ATTRIBUTE_UPDATE_FAILURE: "Failed to update",
136 ATTRIBUTE_ACCESS_DENIED : "Access denied",
137 ATTRIBUTE_UNKNOWN_ERROR : "Unknown error when accessing",
138
139 COMMAND_FAILURE : "Failed to execute command",
140
141 IO_NOT_READY : "Not ready",
142 IO_BUSY : "Busy",
143 IO_TIMEOUT : "Timeout",
144 IO_UNKNOWN_ERROR : "Unknown error in IO operation",
145
146 UNKNOWN_ERROR : "Unknown error",
147 }
148
149 ## Exception indicating a fatal error
150 class FatalError(Exception):
151 pass
152
153 if __name__ == "__main__":
154 pass