github.com/ewagmig/fabric@v2.1.1+incompatible/common/errors/errors.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package errors
     8  
     9  // TxValidationError marks that the error is related to
    10  // validation of a transaction
    11  type TxValidationError interface {
    12  	error
    13  	IsValid() bool
    14  }
    15  
    16  // VSCCInfoLookupFailureError error to indicate inability
    17  // to obtain VSCC information from LCCC
    18  type VSCCInfoLookupFailureError struct {
    19  	Reason string
    20  }
    21  
    22  // Error returns reasons which lead to the failure
    23  func (e VSCCInfoLookupFailureError) Error() string {
    24  	return e.Reason
    25  }
    26  
    27  // VSCCEndorsementPolicyError error to mark transaction
    28  // failed endorsement policy check
    29  type VSCCEndorsementPolicyError struct {
    30  	Err error
    31  }
    32  
    33  func (e *VSCCEndorsementPolicyError) IsValid() bool {
    34  	return e.Err == nil
    35  }
    36  
    37  // Error returns reasons which lead to the failure
    38  func (e VSCCEndorsementPolicyError) Error() string {
    39  	return e.Err.Error()
    40  }
    41  
    42  // VSCCExecutionFailureError error to indicate
    43  // failure during attempt of executing VSCC
    44  // endorsement policy check
    45  type VSCCExecutionFailureError struct {
    46  	Err error
    47  }
    48  
    49  // Error returns reasons which lead to the failure
    50  func (e VSCCExecutionFailureError) Error() string {
    51  	return e.Err.Error()
    52  }
    53  
    54  func (e *VSCCExecutionFailureError) IsValid() bool {
    55  	return e.Err == nil
    56  }