You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
616 B

package types
import (
"errors"
)
type RetCode int
// Reserved return codes
const (
RetCodeOK RetCode = 0
RetCodeInternalError RetCode = 1
RetCodeUnauthorized RetCode = 2
RetCodeInsufficientFees RetCode = 3
RetCodeUnknownRequest RetCode = 4
RetCodeEncodingError RetCode = 5
)
func (r RetCode) Error() error {
switch r {
case RetCodeOK:
return nil
default:
return errors.New(r.String())
}
}
//go:generate stringer -type=RetCode
// NOTE: The previous comment generates r.String().
// To run it, `go get golang.org/x/tools/cmd/stringer`
// and `go generate` in tmsp/types