• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## @file
2# Standardized Error Hanlding infrastructures.
3#
4# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
5#
6# This program and the accompanying materials are licensed and made available
7# under the terms and conditions of the BSD License which accompanies this
8# distribution. The full text of the license may be found at
9# http://opensource.org/licenses/bsd-license.php
10#
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13#
14
15'''
16ToolError
17'''
18
19import Logger.StringTable as ST
20
21FILE_OPEN_FAILURE = 1
22FILE_WRITE_FAILURE = 2
23FILE_PARSE_FAILURE = 3
24FILE_READ_FAILURE = 4
25FILE_CREATE_FAILURE = 5
26FILE_CHECKSUM_FAILURE = 6
27FILE_COMPRESS_FAILURE = 7
28FILE_DECOMPRESS_FAILURE = 8
29FILE_MOVE_FAILURE = 9
30FILE_DELETE_FAILURE = 10
31FILE_COPY_FAILURE = 11
32FILE_POSITIONING_FAILURE = 12
33FILE_ALREADY_EXIST = 13
34FILE_NOT_FOUND = 14
35FILE_TYPE_MISMATCH = 15
36FILE_CASE_MISMATCH = 16
37FILE_DUPLICATED = 17
38FILE_UNKNOWN_ERROR = 0x0FFF
39
40OPTION_UNKNOWN = 0x1000
41OPTION_MISSING = 0x1001
42OPTION_CONFLICT = 0x1002
43OPTION_VALUE_INVALID = 0x1003
44OPTION_DEPRECATED = 0x1004
45OPTION_NOT_SUPPORTED = 0x1005
46OPTION_UNKNOWN_ERROR = 0x1FFF
47
48PARAMETER_INVALID = 0x2000
49PARAMETER_MISSING = 0x2001
50PARAMETER_UNKNOWN_ERROR = 0x2FFF
51
52FORMAT_INVALID = 0x3000
53FORMAT_NOT_SUPPORTED = 0x3001
54FORMAT_UNKNOWN = 0x3002
55FORMAT_UNKNOWN_ERROR = 0x3FFF
56
57RESOURCE_NOT_AVAILABLE = 0x4000
58RESOURCE_ALLOCATE_FAILURE = 0x4001
59RESOURCE_FULL = 0x4002
60RESOURCE_OVERFLOW = 0x4003
61RESOURCE_UNDERRUN = 0x4004
62RESOURCE_UNKNOWN_ERROR = 0x4FFF
63
64ATTRIBUTE_NOT_AVAILABLE = 0x5000
65ATTRIBUTE_GET_FAILURE = 0x5001
66ATTRIBUTE_SET_FAILURE = 0x5002
67ATTRIBUTE_UPDATE_FAILURE = 0x5003
68ATTRIBUTE_ACCESS_DENIED = 0x5004
69ATTRIBUTE_RETRIEVE_FAILURE = 0x5005
70ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
71ATTRIBUTE_RETRIEVE_FAILURE = 0x5F00
72
73IO_NOT_READY = 0x6000
74IO_BUSY = 0x6001
75IO_TIMEOUT = 0x6002
76IO_UNKNOWN_ERROR = 0x6FFF
77
78COMMAND_FAILURE = 0x7000
79
80CODE_ERROR = 0xC0DE
81
82AUTOGEN_ERROR = 0xF000
83PARSER_ERROR = 0xF001
84BUILD_ERROR = 0xF002
85GENFDS_ERROR = 0xF003
86ECC_ERROR = 0xF004
87EOT_ERROR = 0xF005
88DDC_ERROR = 0xF009
89WARNING_AS_ERROR = 0xF006
90MIGRATION_ERROR = 0xF010
91EDK1_INF_ERROR = 0xF011
92ABORT_ERROR = 0xFFFE
93UNKNOWN_ERROR = 0xFFFF
94
95UPT_ALREADY_INSTALLED_ERROR = 0xD000
96UPT_ENVIRON_MISSING_ERROR = 0xD001
97UPT_REPKG_ERROR = 0xD002
98UPT_ALREADY_RUNNING_ERROR = 0xD003
99UPT_MUL_DEC_ERROR = 0xD004
100UPT_DB_UPDATE_ERROR = 0xD005
101UPT_INI_PARSE_ERROR = 0xE000
102
103## Error message of each error code
104#
105gERROR_MESSAGE = {
106    FILE_NOT_FOUND          :   ST.ERR_FILE_NOT_FOUND,
107    FILE_OPEN_FAILURE       :   ST.ERR_FILE_OPEN_FAILURE,
108    FILE_WRITE_FAILURE      :   ST.ERR_FILE_WRITE_FAILURE,
109    FILE_PARSE_FAILURE      :   ST.ERR_FILE_PARSE_FAILURE,
110    FILE_READ_FAILURE       :   ST.ERR_FILE_READ_FAILURE,
111    FILE_CREATE_FAILURE     :   ST.ERR_FILE_CREATE_FAILURE,
112    FILE_CHECKSUM_FAILURE   :   ST.ERR_FILE_CHECKSUM_FAILURE,
113    FILE_COMPRESS_FAILURE   :   ST.ERR_FILE_COMPRESS_FAILURE,
114    FILE_DECOMPRESS_FAILURE :   ST.ERR_FILE_DECOMPRESS_FAILURE,
115    FILE_MOVE_FAILURE       :   ST.ERR_FILE_MOVE_FAILURE,
116    FILE_DELETE_FAILURE     :   ST.ERR_FILE_DELETE_FAILURE,
117    FILE_COPY_FAILURE       :   ST.ERR_FILE_COPY_FAILURE,
118    FILE_POSITIONING_FAILURE:   ST.ERR_FILE_POSITIONING_FAILURE,
119    FILE_ALREADY_EXIST      :   ST.ERR_FILE_ALREADY_EXIST,
120    FILE_TYPE_MISMATCH      :   ST.ERR_FILE_TYPE_MISMATCH ,
121    FILE_CASE_MISMATCH      :   ST.ERR_FILE_CASE_MISMATCH,
122    FILE_DUPLICATED         :   ST.ERR_FILE_DUPLICATED,
123    FILE_UNKNOWN_ERROR      :   ST.ERR_FILE_UNKNOWN_ERROR,
124
125    OPTION_UNKNOWN          :   ST.ERR_OPTION_UNKNOWN,
126    OPTION_MISSING          :   ST.ERR_OPTION_MISSING,
127    OPTION_CONFLICT         :   ST.ERR_OPTION_CONFLICT,
128    OPTION_VALUE_INVALID    :   ST.ERR_OPTION_VALUE_INVALID,
129    OPTION_DEPRECATED       :   ST.ERR_OPTION_DEPRECATED,
130    OPTION_NOT_SUPPORTED    :   ST.ERR_OPTION_NOT_SUPPORTED,
131    OPTION_UNKNOWN_ERROR    :   ST.ERR_OPTION_UNKNOWN_ERROR,
132
133    PARAMETER_INVALID       :   ST.ERR_PARAMETER_INVALID,
134    PARAMETER_MISSING       :   ST.ERR_PARAMETER_MISSING,
135    PARAMETER_UNKNOWN_ERROR :   ST.ERR_PARAMETER_UNKNOWN_ERROR,
136
137    FORMAT_INVALID          :   ST.ERR_FORMAT_INVALID,
138    FORMAT_NOT_SUPPORTED    :   ST.ERR_FORMAT_NOT_SUPPORTED,
139    FORMAT_UNKNOWN          :   ST.ERR_FORMAT_UNKNOWN,
140    FORMAT_UNKNOWN_ERROR    :   ST.ERR_FORMAT_UNKNOWN_ERROR,
141
142    RESOURCE_NOT_AVAILABLE  :   ST.ERR_RESOURCE_NOT_AVAILABLE,
143    RESOURCE_ALLOCATE_FAILURE : ST.ERR_RESOURCE_ALLOCATE_FAILURE,
144    RESOURCE_FULL           :   ST.ERR_RESOURCE_FULL,
145    RESOURCE_OVERFLOW       :   ST.ERR_RESOURCE_OVERFLOW,
146    RESOURCE_UNDERRUN       :   ST.ERR_RESOURCE_UNDERRUN,
147    RESOURCE_UNKNOWN_ERROR  :   ST.ERR_RESOURCE_UNKNOWN_ERROR,
148
149    ATTRIBUTE_NOT_AVAILABLE :   ST.ERR_ATTRIBUTE_NOT_AVAILABLE,
150    ATTRIBUTE_RETRIEVE_FAILURE : ST.ERR_ATTRIBUTE_RETRIEVE_FAILURE,
151    ATTRIBUTE_SET_FAILURE   :   ST.ERR_ATTRIBUTE_SET_FAILURE,
152    ATTRIBUTE_UPDATE_FAILURE:   ST.ERR_ATTRIBUTE_UPDATE_FAILURE,
153    ATTRIBUTE_ACCESS_DENIED :   ST.ERR_ATTRIBUTE_ACCESS_DENIED,
154    ATTRIBUTE_UNKNOWN_ERROR :   ST.ERR_ATTRIBUTE_UNKNOWN_ERROR,
155
156    COMMAND_FAILURE         :   ST.ERR_COMMAND_FAILURE,
157
158    IO_NOT_READY            :   ST.ERR_IO_NOT_READY,
159    IO_BUSY                 :   ST.ERR_IO_BUSY,
160    IO_TIMEOUT              :   ST.ERR_IO_TIMEOUT,
161    IO_UNKNOWN_ERROR        :   ST.ERR_IO_UNKNOWN_ERROR,
162
163    UNKNOWN_ERROR           :   ST.ERR_UNKNOWN_ERROR,
164
165    UPT_ALREADY_INSTALLED_ERROR : ST.ERR_UPT_ALREADY_INSTALLED_ERROR,
166    UPT_ENVIRON_MISSING_ERROR   : ST.ERR_UPT_ENVIRON_MISSING_ERROR,
167    UPT_REPKG_ERROR             : ST.ERR_UPT_REPKG_ERROR,
168    UPT_ALREADY_RUNNING_ERROR   : ST.ERR_UPT_ALREADY_RUNNING_ERROR,
169    UPT_MUL_DEC_ERROR           : ST.ERR_MUL_DEC_ERROR,
170    UPT_INI_PARSE_ERROR     :   ST.ERR_UPT_INI_PARSE_ERROR,
171}
172
173## Exception indicating a fatal error
174#
175class FatalError(Exception):
176    pass
177
178