github.com/uuosio/chaintester@v0.0.0-20230731100329-1f6fad7372e5/error.go (about)

     1  package chaintester
     2  
     3  import "encoding/json"
     4  
     5  type AssertError struct {
     6  	Err error
     7  }
     8  
     9  func (err *AssertError) Error() string {
    10  	return err.Err.Error()
    11  }
    12  
    13  func NewAssertError(err error) *AssertError {
    14  	return &AssertError{err}
    15  }
    16  
    17  type TransactionError struct {
    18  	Err []byte
    19  }
    20  
    21  func (t *TransactionError) Error() string {
    22  	return string(t.Err)
    23  }
    24  
    25  func (t *TransactionError) Json() *JsonValue {
    26  	value := &JsonValue{}
    27  	// fmt.Printf("++++++push_action return: %v", string(ret))
    28  	err := json.Unmarshal(t.Err, value)
    29  	if err != nil {
    30  		return nil
    31  	}
    32  	return value
    33  }
    34  
    35  func NewTransactionError(value []byte) *TransactionError {
    36  	return &TransactionError{value}
    37  }