github.com/koko1123/flow-go-1@v0.29.6/fvm/errors/codes.go (about)

     1  package errors
     2  
     3  import "fmt"
     4  
     5  type ErrorCode uint16
     6  
     7  func (ec ErrorCode) IsFailure() bool {
     8  	return ec >= FailureCodeUnknownFailure
     9  }
    10  
    11  func (ec ErrorCode) String() string {
    12  	if ec.IsFailure() {
    13  		return fmt.Sprintf("[Failure Code: %d]", ec)
    14  	}
    15  	return fmt.Sprintf("[Error Code: %d]", ec)
    16  }
    17  
    18  const (
    19  	FailureCodeUnknownFailure     ErrorCode = 2000
    20  	FailureCodeEncodingFailure    ErrorCode = 2001
    21  	FailureCodeLedgerFailure      ErrorCode = 2002
    22  	FailureCodeStateMergeFailure  ErrorCode = 2003
    23  	FailureCodeBlockFinderFailure ErrorCode = 2004
    24  	// Deprecated: No longer used.
    25  	FailureCodeHasherFailure                           ErrorCode = 2005
    26  	FailureCodeParseRestrictedModeInvalidAccessFailure ErrorCode = 2006
    27  	FailureCodePayerBalanceCheckFailure                ErrorCode = 2007
    28  	// Deprecated: No longer used.
    29  	FailureCodeMetaTransactionFailure ErrorCode = 2100
    30  )
    31  
    32  const (
    33  	// tx validation errors 1000 - 1049
    34  	// Deprecated: no longer in use
    35  	ErrCodeTxValidationError ErrorCode = 1000
    36  	// Deprecated: No longer used.
    37  	ErrCodeInvalidTxByteSizeError ErrorCode = 1001
    38  	// Deprecated: No longer used.
    39  	ErrCodeInvalidReferenceBlockError ErrorCode = 1002
    40  	// Deprecated: No longer used.
    41  	ErrCodeExpiredTransactionError ErrorCode = 1003
    42  	// Deprecated: No longer used.
    43  	ErrCodeInvalidScriptError ErrorCode = 1004
    44  	// Deprecated: No longer used.
    45  	ErrCodeInvalidGasLimitError          ErrorCode = 1005
    46  	ErrCodeInvalidProposalSignatureError ErrorCode = 1006
    47  	ErrCodeInvalidProposalSeqNumberError ErrorCode = 1007
    48  	ErrCodeInvalidPayloadSignatureError  ErrorCode = 1008
    49  	ErrCodeInvalidEnvelopeSignatureError ErrorCode = 1009
    50  
    51  	// base errors 1050 - 1100
    52  	// Deprecated: No longer used.
    53  	ErrCodeFVMInternalError            ErrorCode = 1050
    54  	ErrCodeValueError                  ErrorCode = 1051
    55  	ErrCodeInvalidArgumentError        ErrorCode = 1052
    56  	ErrCodeInvalidAddressError         ErrorCode = 1053
    57  	ErrCodeInvalidLocationError        ErrorCode = 1054
    58  	ErrCodeAccountAuthorizationError   ErrorCode = 1055
    59  	ErrCodeOperationAuthorizationError ErrorCode = 1056
    60  	ErrCodeOperationNotSupportedError  ErrorCode = 1057
    61  
    62  	// execution errors 1100 - 1200
    63  	// Deprecated: No longer used.
    64  	ErrCodeExecutionError      ErrorCode = 1100
    65  	ErrCodeCadenceRunTimeError ErrorCode = 1101
    66  	// Deprecated: No longer used.
    67  	ErrCodeEncodingUnsupportedValue ErrorCode = 1102
    68  	ErrCodeStorageCapacityExceeded  ErrorCode = 1103
    69  	// Deprecated: No longer used.
    70  	ErrCodeGasLimitExceededError                     ErrorCode = 1104
    71  	ErrCodeEventLimitExceededError                   ErrorCode = 1105
    72  	ErrCodeLedgerInteractionLimitExceededError       ErrorCode = 1106
    73  	ErrCodeStateKeySizeLimitError                    ErrorCode = 1107
    74  	ErrCodeStateValueSizeLimitError                  ErrorCode = 1108
    75  	ErrCodeTransactionFeeDeductionFailedError        ErrorCode = 1109
    76  	ErrCodeComputationLimitExceededError             ErrorCode = 1110
    77  	ErrCodeMemoryLimitExceededError                  ErrorCode = 1111
    78  	ErrCodeCouldNotDecodeExecutionParameterFromState ErrorCode = 1112
    79  	ErrCodeScriptExecutionCancelledError             ErrorCode = 1114
    80  	ErrCodeScriptExecutionTimedOutError              ErrorCode = 1113
    81  	ErrCodeEventEncodingError                        ErrorCode = 1115
    82  	ErrCodeInvalidFVMStateAccessError                ErrorCode = 1116
    83  	// 1117 was never deployed and is free to use
    84  	ErrCodeInsufficientPayerBalance ErrorCode = 1118
    85  
    86  	// accounts errors 1200 - 1250
    87  	// Deprecated: No longer used.
    88  	ErrCodeAccountError                  ErrorCode = 1200
    89  	ErrCodeAccountNotFoundError          ErrorCode = 1201
    90  	ErrCodeAccountPublicKeyNotFoundError ErrorCode = 1202
    91  	ErrCodeAccountAlreadyExistsError     ErrorCode = 1203
    92  	ErrCodeFrozenAccountError            ErrorCode = 1204
    93  	// Deprecated: No longer used.
    94  	ErrCodeAccountStorageNotInitializedError ErrorCode = 1205
    95  	ErrCodeAccountPublicKeyLimitError        ErrorCode = 1206
    96  
    97  	// contract errors 1250 - 1300
    98  	// Deprecated: No longer used.
    99  	ErrCodeContractError         ErrorCode = 1250
   100  	ErrCodeContractNotFoundError ErrorCode = 1251
   101  	// Deprecated: No longer used.
   102  	ErrCodeContractNamesNotFoundError ErrorCode = 1252
   103  )