func AllErrors() []*rtypes.Error {
	errs := make([]*rtypes.Error, 0, nbErrorCodes)
	for i := ErrorCode(0); i < nbErrorCodes; i++ {
		errs = append(errs, i.RError())
	}
	return errs
}
AllErrors returns all known error codes in a format suitable for inclusion
in an Allow response.
package types
import (
	"context"
	"errors"
	"fmt"
	rtypes "github.com/coinbase/rosetta-sdk-go/types"
)
type ErrorCode int32
type RosettaError interface {
	RError() *rtypes.Error
}
const (
	ErrUnknown ErrorCode = iota
	ErrRequestCanceled
	ErrInvalidChainHash
	ErrInvalidArgument
	ErrBlockNotFound
	ErrTxNotFound
	ErrUnimplemented
	ErrInvalidTransaction
	ErrInvalidHexString
	ErrAlreadyHaveTx
	ErrTxAlreadyMined
	ErrProcessingTx
	ErrInvalidAccountIdAddr
	ErrBlockIndexAfterTip
	ErrUnsupportedCurveType
	ErrInvalidSecp256k1PubKey
	ErrNotCompressedSecp256k1Key
	ErrUnspecifiedAddressVersion
	ErrUnsupportedAddressVersion
	ErrUnsupportedAddressAlgo
	ErrUnkownOpType
	ErrInvalidOp
	ErrInvalidTxMetadata
	ErrIncorrectSigCount
	ErrUnsupportedSignatureType
	ErrSerializeSizeUnspecified
	ErrSerSizeNotNumber
	ErrIncorrectSigSize
	ErrInvalidSig
	ErrInvalidPubKey
	ErrChainUnavailable
	ErrPrevOutTxNotFound
	ErrPrevOutIndexNotFound
	ErrNilAccount
	nbErrorCodes
)
var errorCodeMsgs = map[ErrorCode]string{
	ErrUnknown:                   "unknown error",
	ErrRequestCanceled:           "request canceled",
	ErrInvalidChainHash:          "invalid chain hash",
	ErrInvalidArgument:           "invalid argument",
	ErrBlockNotFound:             "block not found",
	ErrTxNotFound:                "tx not found",
	ErrUnimplemented:             "unimplemented",
	ErrInvalidTransaction:        "invalid transaction",
	ErrInvalidHexString:          "invalid hex string",
	ErrAlreadyHaveTx:             "already have transaction",
	ErrTxAlreadyMined:            "tx already mined",
	ErrProcessingTx:              "error processing tx",
	ErrInvalidAccountIdAddr:      "invalid address in account identifier",
	ErrBlockIndexAfterTip:        "block index after current mainchain tip",
	ErrUnsupportedCurveType:      "unsupported curve type",
	ErrInvalidSecp256k1PubKey:    "invalid secp256k1 pubkey",
	ErrNotCompressedSecp256k1Key: "secp256k1 pubkey is not in compressed format",
	ErrUnspecifiedAddressVersion: "address version was not specified",
	ErrUnsupportedAddressVersion: "unsupported address version",
	ErrUnsupportedAddressAlgo:    "unsupported address algo",
	ErrUnkownOpType:              "unknown op type",
	ErrInvalidOp:                 "invalid op",
	ErrInvalidTxMetadata:         "invalid tx metadata",
	ErrIncorrectSigCount:         "incorrect signature count",
	ErrUnsupportedSignatureType:  "unsupported signature type",
	ErrSerializeSizeUnspecified:  "serialize_size was not specified",
	ErrSerSizeNotNumber:          "serialize_size is not a number",
	ErrIncorrectSigSize:          "incorrect signature size",
	ErrInvalidSig:                "invalid signature",
	ErrInvalidPubKey:             "invalid public key",
	ErrChainUnavailable:          "chain unavailable",
	ErrPrevOutTxNotFound:         "previous output tx not found",
	ErrPrevOutIndexNotFound:      "previous output tx index not found",
	ErrNilAccount:                "account cannot be nil",
}
func (err ErrorCode) Error() string {
	s := "undefined error code"
	if msg, ok := errorCodeMsgs[err]; ok {
		s = msg
	}
	return s
}
func (err ErrorCode) Is(target error) bool {
	switch target := target.(type) {
	case ErrorCode:
		return target == err
	case Error:
		return target.code == err
	case RosettaError:
		rerr := target.RError()
		if rerr != nil {
			return ErrorCode(rerr.Code) == err
		}
	}
	return false
}
func (err ErrorCode) AsError() Error {
	return Error{
		code: err,
	}
}
func (err ErrorCode) Retriable() Error {
	return err.AsError().Retriable()
}
func (err ErrorCode) Msg(m string) Error {
	return err.AsError().Msg(m)
}
func (err ErrorCode) Msgf(format string, args ...interface{}) Error {
	return err.AsError().Msgf(format, args...)
}
func (err ErrorCode) RError() *rtypes.Error {
	return err.AsError().RError()
}
type Error struct {
	code      ErrorCode
	msg       string
	retriable bool
}
func (err Error) Error() string {
	if err.msg != "" {
		return err.msg
	}
	return errorCodeMsgs[err.code]
}
func (err Error) Is(target error) bool {
	switch target := target.(type) {
	case ErrorCode:
		return target == err.code
	case Error:
		return target.code == err.code
	case RosettaError:
		rerr := target.RError()
		if rerr != nil {
			return ErrorCode(rerr.Code) == err.code
		}
	}
	return false
}
func (err Error) Unwrap() error {
	return err.code
}
func (err Error) Retriable() Error {
	return Error{
		code:      err.code,
		msg:       err.msg,
		retriable: true,
	}
}
func (err Error) Msg(m string) Error {
	return Error{
		code:      err.code,
		msg:       m,
		retriable: err.retriable,
	}
}
func (err Error) Msgf(format string, args ...interface{}) Error {
	return Error{
		code:      err.code,
		msg:       fmt.Sprintf(format, args...),
		retriable: err.retriable,
	}
}
func (err Error) RError() *rtypes.Error {
	var details map[string]interface{}
	if err.msg != "" {
		details = make(map[string]interface{}, 1)
		details["error"] = err.msg
	}
	return &rtypes.Error{
		Code:      int32(err.code),
		Message:   errorCodeMsgs[err.code],
		Retriable: err.retriable,
		Details:   details,
	}
}