Versions in this module Expand all Collapse all v0 v0.3.0 Mar 13, 2019 Changes in this version + var AlreadyExistsCode = StateCode.Child("state.exists").SetHTTP(http.StatusConflict) + var AuthCode = NewCode("auth") + var ForbiddenCode = AuthCode.Child("auth.forbidden").SetHTTP(http.StatusForbidden) + var InternalCode = NewCode("internal").SetHTTP(http.StatusInternalServerError) + var InvalidInputCode = NewCode("input").SetHTTP(http.StatusBadRequest) + var NotAuthenticatedCode = AuthCode.Child("auth.unauthenticated").SetHTTP(http.StatusUnauthorized) + var NotFoundCode = NewCode("missing").SetHTTP(http.StatusNotFound) + var OutOfRangeCode = StateCode.Child("state.range") + var StateCode = NewCode("state").SetHTTP(http.StatusBadRequest) + var UnimplementedCode = InternalCode.Child("internal.unimplemented").SetHTTP(http.StatusNotImplemented) + func ClientData(errCode ErrorCode) interface + func Operation(v interface{}) string + func OperationClientData(errCode ErrorCode) (string, interface{}) + func StackTrace(err error) errors.StackTrace + type AddOp func(ErrorCode) OpErrCode + func Op(operation string) AddOp + func (addOp AddOp) AddTo(err ErrorCode) OpErrCode + type Causer interface + Cause func() error + type ChainContext struct + ErrCode ErrorCode + Top error + func (err ChainContext) Cause() error + func (err ChainContext) Code() Code + func (err ChainContext) Error() string + func (err ChainContext) Format(s fmt.State, verb rune) + func (err ChainContext) GetClientData() interface{} + type Code struct + Parent *Code + func NewCode(codeRep CodeStr) Code + func (code Code) Child(childStr CodeStr) Code + func (code Code) CodeStr() CodeStr + func (code Code) HTTPCode() int + func (code Code) IsAncestor(ancestorCode Code) bool + func (code Code) MetaDataFromAncestors(metaData MetaData) interface{} + func (code Code) SetHTTP(httpCode int) Code + func (code Code) SetMetaData(metaData MetaData, item interface{}) error + type CodeStr string + func (str CodeStr) String() string + type CodedError struct + Err error + GetCode Code + func NewCodedError(err error, code Code) CodedError + func (e CodedError) Cause() error + func (e CodedError) Code() Code + func (e CodedError) Error() string + func (e CodedError) GetClientData() interface{} + type EmbedOp struct + Op string + func (e EmbedOp) GetOperation() string + type ErrorCode interface + Code func() Code + Error func() string + func CodeChain(err error) ErrorCode + func ErrorCodes(err error) []ErrorCode + func NewForbiddenErr(err error) ErrorCode + func NewInternalErr(err error) ErrorCode + func NewInvalidInputErr(err error) ErrorCode + func NewNotAuthenticatedErr(err error) ErrorCode + func NewNotFoundErr(err error) ErrorCode + func NewUnimplementedErr(err error) ErrorCode + type HasClientData interface + GetClientData func() interface{} + type HasOperation interface + GetOperation func() string + type JSONFormat struct + Code CodeStr + Data interface{} + Msg string + Operation string + Others []JSONFormat + Stack errors.StackTrace + func NewJSONFormat(errCode ErrorCode) JSONFormat + type MetaData map[CodeStr]interface + type MultiErrCode struct + ErrCode ErrorCode + func Combine(initial ErrorCode, others ...ErrorCode) MultiErrCode + func (e MultiErrCode) Cause() error + func (e MultiErrCode) Code() Code + func (e MultiErrCode) Error() string + func (e MultiErrCode) Errors() []error + func (e MultiErrCode) Format(s fmt.State, verb rune) + func (e MultiErrCode) GetClientData() interface{} + type OpErrCode struct + Err ErrorCode + Operation string + func (e OpErrCode) Cause() error + func (e OpErrCode) Code() Code + func (e OpErrCode) Error() string + func (e OpErrCode) GetClientData() interface{} + func (e OpErrCode) GetOperation() string + type StackCode struct + Err ErrorCode + GetStack errors.StackTracer + func NewStackCode(err ErrorCode, position ...int) StackCode + func (e StackCode) Cause() error + func (e StackCode) Code() Code + func (e StackCode) Error() string + func (e StackCode) GetClientData() interface{} + func (e StackCode) StackTrace() errors.StackTrace