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