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