Documentation
¶
Index ¶
- Variables
- func Append(old, new error) error
- func NewClientErr(op string, err error, resp *http.Response, opts ...ClientOptFn) error
- type ClientErr
- type ClientOptFn
- type ConflictSVCErr
- type ConflictSVCErrGenFn
- type Conflicter
- type Exister
- type ExistsErrGenFn
- type ExistsSVCErr
- type HTTP
- type HTTPErr
- type HTTPInternalMessageError
- type InternalErrorMessage
- type NotFoundSVCErr
- type NotFoundSVCErrGenFn
- type NotFounder
- type Retrier
- type SVCErr
- type Temporarier
- type TemporarySVCErr
- type TemporarySVCErrGenFn
Constants ¶
This section is empty.
Variables ¶
var ( // NewExistsSVCErrGen is a generator function for building ExistsSVCErrs with the specified // resource supplied to all exists errs created. NewExistsSVCErrGen = func(resource string) ExistsErrGenFn { return func(op, msg string) *ExistsSVCErr { return NewExistsSVCErr(resource, op, msg) } } // NewNotFoundSVCErrGen is a generator function for building NotFoundSVCErrs with the specified // resource supplied to all not found errs created. NewNotFoundSVCErrGen = func(resource string) NotFoundSVCErrGenFn { return func(op, msg string) *NotFoundSVCErr { return NewNotFoundSVCErr(resource, op, msg) } } // NewConflictSVCErrGen is a generator function for building ConflictSVCErrs with the specified // resource supplied to all conflict errs created. NewConflictSVCErrGen = func(resource string) ConflictSVCErrGenFn { return func(op, msg string) *ConflictSVCErr { return NewConflictSVCErr(resource, op, msg) } } // NewTemporarySVCErrGen is a generator function for building TemporarySVCErrs with the specified // resource supplied to all conflict errs created. NewTemporarySVCErrGen = func(resource string) TemporarySVCErrGenFn { return func(op, msg string) *TemporarySVCErr { return NewTemporarySVCErr(resource, op, msg) } } )
Functions ¶
func NewClientErr ¶
NewClientErr is a constructor for a client error. The provided options allow the caller to set an optional retry.
Types ¶
type ClientErr ¶
type ClientErr struct { StatusCode int // contains filtered or unexported fields }
ClientErr is an error type that provides useful error messages that include both request and response bodies, status code of response and valid request parameters.
func (*ClientErr) BackoffMessage ¶
BackoffMessage provides a condensed error message that can be consumed during a backoff loop.
type ClientOptFn ¶
ClientOptFn is a optional parameter that allows one to extend a client error.
func Meta ¶
func Meta(key, value string, pairs ...string) ClientOptFn
Meta sets key value pairs to add context to the error output.
func NotFound ¶
func NotFound() ClientOptFn
NotFound sets the client error to NotFound, notFound=true.
func Retry ¶
func Retry() ClientOptFn
Retry sets the option and subsequent client error to retriable, retry=true.
type ConflictSVCErr ¶
type ConflictSVCErr struct {
*SVCErr
}
ConflictSVCErr is a service error for a conflict behavior.
func NewConflictSVCErr ¶
func NewConflictSVCErr(resource, op, msg string) *ConflictSVCErr
NewConflictSVCErr is constructor for a ConflictSVC error.
func (*ConflictSVCErr) Conflict ¶
func (*ConflictSVCErr) Conflict() bool
Conflict provides the conflict behavior.
type ConflictSVCErrGenFn ¶
type ConflictSVCErrGenFn func(op, msg string) *ConflictSVCErr
ConflictSVCErrGenFn is a function for generating a conflict error from the supplied operation and errMsg parameters.
type Conflicter ¶
type Conflicter interface {
Conflict() bool
}
Conflicter determines if an error exhibits the behavior of a conflict err. This corresponds to times when you receive unexpected errors or an error of high severity.
type Exister ¶
type Exister interface {
Exists() bool
}
Exister determines if an error exhibits the behavior of a resource already exists err.
type ExistsErrGenFn ¶
type ExistsErrGenFn func(op, msg string) *ExistsSVCErr
ExistsErrGenFn is a function for generating an exists error from the supplied operation and errMsg paramets.
type ExistsSVCErr ¶
type ExistsSVCErr struct {
*SVCErr
}
ExistsSVCErr is a service error for an exists behavior.
func NewExistsSVCErr ¶
func NewExistsSVCErr(resource, op, msg string) *ExistsSVCErr
NewExistsSVCErr is a constructor for an ExistsSVCErr.
func (*ExistsSVCErr) Exists ¶
func (*ExistsSVCErr) Exists() bool
Exists provides the exists behavior.
type HTTP ¶
type HTTP interface {
StatusCode() int
}
HTTP determines if an error exhibits the behavior of an error that provides an HTTP status code and the error message itself is safe for returning to a client.
type HTTPErr ¶
HTTPErr is a error that provides a status code and a message that is safe for clients to view.
func (*HTTPErr) StatusCode ¶
StatusCode provides the status code associated with the error message.
type HTTPInternalMessageError ¶
type HTTPInternalMessageError struct {
// contains filtered or unexported fields
}
HTTPInternalMessageError provides a status code, message safe for clients to view, and wraps an error for logging internally.
func NewHTTPInternalMessageError ¶
func NewHTTPInternalMessageError(err error, msg string, code int) *HTTPInternalMessageError
NewHTTPInternalMessageError initializes an HTTPInternalMessageError.
func (*HTTPInternalMessageError) Error ¶
func (e *HTTPInternalMessageError) Error() string
Error provides the client-safe error message
func (*HTTPInternalMessageError) InternalErrorMessage ¶
func (e *HTTPInternalMessageError) InternalErrorMessage() string
InternalErrorMessage provides the internal-only wrapped error message.
func (*HTTPInternalMessageError) StatusCode ¶
func (e *HTTPInternalMessageError) StatusCode() int
StatusCode provides the http status code associated with this message.
type InternalErrorMessage ¶
type InternalErrorMessage interface {
InternalErrorMessage() string
}
InternalErrorMessage provides a message separate from that returned by a call to Error() that is for internal (non-client) consumption.
type NotFoundSVCErr ¶
type NotFoundSVCErr struct {
*SVCErr
}
NotFoundSVCErr is a service error for a not found behavior.
func NewNotFoundSVCErr ¶
func NewNotFoundSVCErr(resource, op, msg string) *NotFoundSVCErr
NewNotFoundSVCErr is a constructor for a NotFoundSVC error.
func (*NotFoundSVCErr) NotFound ¶
func (*NotFoundSVCErr) NotFound() bool
NotFound provides the not found behavior.
type NotFoundSVCErrGenFn ¶
type NotFoundSVCErrGenFn func(op, msg string) *NotFoundSVCErr
NotFoundSVCErrGenFn is a function for generating a not found error from the supplied operation and errMsg parameters.
type NotFounder ¶
type NotFounder interface {
NotFound() bool
}
NotFounder determines if an error exhibits the behavior of a resource not found err.
type Retrier ¶
type Retrier interface {
Retry() bool
}
Retrier determines if an error exhibits the behavior of an error that is safe to retry. TODO: a lot of times these types of errors may respond with a time/duration for when a retry is safe to commence. May be worth considering.
type SVCErr ¶
type SVCErr struct {
// contains filtered or unexported fields
}
SVCErr is a service error for that provides the basic data for all service errors.
type Temporarier ¶
type Temporarier interface {
Temporary() bool
}
Temporarier determines if an error exhibits the behavior of a system with services that are unreachable for whatever reason and are temporarily unavailable.
type TemporarySVCErr ¶
type TemporarySVCErr struct {
*SVCErr
}
TemporarySVCErr is a service error for a temporary behavior.
func NewTemporarySVCErr ¶
func NewTemporarySVCErr(resource, op, msg string) *TemporarySVCErr
NewTemporarySVCErr is constructor for a TemporarySVC error.
func (*TemporarySVCErr) Temporary ¶
func (*TemporarySVCErr) Temporary() bool
Temporary provides the conflict behavior.
type TemporarySVCErrGenFn ¶
type TemporarySVCErrGenFn func(op, msg string) *TemporarySVCErr
TemporarySVCErrGenFn is a function for generating a temporary error from the supplied operation and errMsg parameters.