Documentation ¶
Overview ¶
Structured errors for Dashborg providing a wrapped error with error codes.
Index ¶
- func AsProtoErr(err error) *dashproto.ErrorType
- func CanRetry(err error) bool
- func ErrWithCode(code ErrCode, err error) error
- func ErrWithCodeStr(code ErrCode, errStr string) error
- func FromProtoErr(perr *dashproto.ErrorType) error
- func FromRtnStatus(apiName string, rtnStatus *dashproto.RtnStatus) error
- func GetMessage(err error) string
- func JsonMarshalErr(thing string, err error) error
- func JsonUnmarshalErr(thing string, err error) error
- func LimitErr(message string, limitName string, limitMax float64) error
- func MakeDashErr(code ErrCode, isPermanent bool, err error) error
- func NoRetryErr(err error) error
- func NoRetryErrWithCode(code ErrCode, err error) error
- func RpcErr(apiName string, respErr error) error
- func ValidateErr(err error) error
- type DashErr
- type ErrCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsProtoErr ¶ added in v0.7.2
Creates a dashproto.ErrorType from the fields of DashErr
func ErrWithCode ¶
Wraps err into a DashErr with the given error code
func ErrWithCodeStr ¶
Wraps errStr into a DashErr with the given error code
func FromProtoErr ¶ added in v0.7.2
Turns a dashproto.ErrorType into a DashErr
func FromRtnStatus ¶
Creates a DashErr from a gRPC RtnStatus
func GetMessage ¶ added in v0.7.1
If err is a DashErr, unwraps it to return the inner error message, otherwise just calls Error().
func JsonMarshalErr ¶
Creates a DashErr from a json.Marshal error
func JsonUnmarshalErr ¶
Creates a DashErr from a json.Unmarshal error
func MakeDashErr ¶
Creates a DashErr
func NoRetryErrWithCode ¶
Wraps err into a DashErr with the given error code and no-retry set.
Types ¶
type DashErr ¶
type DashErr struct {
// contains filtered or unexported fields
}
type ErrCode ¶
type ErrCode string
const ( ErrCodeNone ErrCode = "" ErrCodeEof ErrCode = "EOF" ErrCodeUnknown ErrCode = "UNKNOWN" ErrCodeBadConnId ErrCode = "BADCONNID" ErrCodeAccAccess ErrCode = "ACCACCESS" ErrCodeNoHandler ErrCode = "NOHANDLER" ErrCodeBadAuth ErrCode = "BADAUTH" ErrCodeRoleAuth ErrCode = "BADROLE" ErrCodeBadZone ErrCode = "BADZONE" ErrCodeNoAcc ErrCode = "NOACC" ErrCodeOffline ErrCode = "OFFLINE" ErrCodePanic ErrCode = "PANIC" ErrCodeJson ErrCode = "JSON" ErrCodeRpc ErrCode = "RPC" ErrCodeUpload ErrCode = "UPLOAD" ErrCodeLimit ErrCode = "LIMIT" ErrCodeNotConnected ErrCode = "NOCONN" ErrCodeValidation ErrCode = "NOTVALID" ErrCodeQueueFull ErrCode = "QUEUE" ErrCodeTimeout ErrCode = "TIMEOUT" ErrCodeNotImpl ErrCode = "NOTIMPL" ErrCodePathNotFound ErrCode = "NOTFOUND" ErrCodeBadPath ErrCode = "BADPATH" ErrCodeNoApp ErrCode = "NOAPP" ErrCodeProtocol ErrCode = "PROTOCOL" ErrCodeInitErr ErrCode = "INITERR" )
func GetErrCode ¶
If err is a DashErr returns the error code, otherwise returns "" for non-DashErr errors.