github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/sdk/bank/errors.go (about)

     1  package bank
     2  
     3  import (
     4  	"github.com/gnolang/gno/tm2/pkg/errors"
     5  )
     6  
     7  // for convenience:
     8  type abciError struct{}
     9  
    10  func (abciError) AssertABCIError() {}
    11  
    12  // declare all bank errors.
    13  // NOTE: these are meant to be used in conjunction with pkgs/errors.
    14  type NoInputsError struct{ abciError }
    15  
    16  type (
    17  	NoOutputsError           struct{ abciError }
    18  	InputOutputMismatchError struct{ abciError }
    19  )
    20  
    21  func (e NoInputsError) Error() string  { return "no inputs in send transaction" }
    22  func (e NoOutputsError) Error() string { return "no outputs in send transaction" }
    23  func (e InputOutputMismatchError) Error() string {
    24  	return "sum inputs != sum outputs in send transaction"
    25  }
    26  
    27  func ErrNoInputs() error {
    28  	return errors.Wrap(NoInputsError{}, "")
    29  }
    30  
    31  func ErrNoOutputs() error {
    32  	return errors.Wrap(NoOutputsError{}, "")
    33  }
    34  
    35  func ErrInputOutputMismatch() error {
    36  	return errors.Wrap(InputOutputMismatchError{}, "")
    37  }