Documentation ¶
Index ¶
Constants ¶
const (
ClientErrorCode int = 0
)
Error codes are not defined in HTTP status codes
Variables ¶
This section is empty.
Functions ¶
func NewErrContractInvalid ¶
NewErrContractInvalid returns an instance of the error interface with ErrContractInvalid as its implementation.
Types ¶
type CommonEdgeX ¶
type CommonEdgeX struct {
// contains filtered or unexported fields
}
CommonEdgeX generalizes an error structure which can be used for any type of EdgeX error.
func NewCommonEdgeX ¶
func NewCommonEdgeX(kind ErrKind, message string, wrappedError error) CommonEdgeX
NewCommonEdgeX creates a new CommonEdgeX with the information provided.
func NewCommonEdgeXWrapper ¶
func NewCommonEdgeXWrapper(wrappedError error) CommonEdgeX
NewCommonEdgeXWrapper creates a new CommonEdgeX to wrap another error to record the function call stacks.
func (CommonEdgeX) Code ¶
func (ce CommonEdgeX) Code() int
Code returns the status code of this error.
func (CommonEdgeX) DebugMessages ¶
func (ce CommonEdgeX) DebugMessages() string
DebugMessages returns a string taking all nested and wrapped operations and errors into account.
func (CommonEdgeX) Error ¶
func (ce CommonEdgeX) Error() string
Error creates an error message taking all nested and wrapped errors into account.
func (CommonEdgeX) Is ¶
func (ce CommonEdgeX) Is(err error) bool
Is determines if an error is of type CommonEdgeX. This is used by the new wrapping and unwrapping features available in Go 1.13 and aids the errors.Is function when determining is an error or any error in the wrapped chain contains an error of a particular type.
func (CommonEdgeX) Message ¶
func (ce CommonEdgeX) Message() string
Message returns the first level error message without further details.
func (CommonEdgeX) Unwrap ¶
func (ce CommonEdgeX) Unwrap() error
Unwrap retrieves the next nested error in the wrapped error chain. This is used by the new wrapping and unwrapping features available in Go 1.13 and aids in traversing the error chain of wrapped errors.
type EdgeX ¶
type EdgeX interface { // Error obtains the error message associated with the error. Error() string // DebugMessages returns a detailed string for debug purpose. DebugMessages() string // Message returns the first level error message without further details. Message() string // Code returns the status code of this error. Code() int }
EdgeX provides an abstraction for all internal EdgeX errors. This exists so that we can use this type in our method signatures and return nil which will fit better with the way the Go builtin errors are normally handled.
type ErrContractInvalid ¶
type ErrContractInvalid struct {
// contains filtered or unexported fields
}
ErrContractInvalid is a specific error type for handling model validation failures. Type checking within the calling application will facilitate more explicit error handling whereby it's clear that validation has failed as opposed to something unexpected happening.
func (ErrContractInvalid) Error ¶
func (e ErrContractInvalid) Error() string
Error fulfills the error interface and returns an error message assembled from the state of ErrContractInvalid.
type ErrKind ¶
type ErrKind string
ErrKind a categorical identifier used to give high-level insight as to the error type.
const ( // Constant Kind identifiers which can be used to label and group errors. KindUnknown ErrKind = "Unknown" KindDatabaseError ErrKind = "Database" KindCommunicationError ErrKind = "Communication" KindEntityDoesNotExist ErrKind = "NotFound" KindContractInvalid ErrKind = "ContractInvalid" KindServerError ErrKind = "UnexpectedServerError" KindLimitExceeded ErrKind = "LimitExceeded" KindStatusConflict ErrKind = "StatusConflict" KindDuplicateName ErrKind = "DuplicateName" KindInvalidId ErrKind = "InvalidId" KindNotAllowed ErrKind = "NotAllowed" KindServiceLocked ErrKind = "ServiceLocked" KindNotImplemented ErrKind = "NotImplemented" KindRangeNotSatisfiable ErrKind = "RangeNotSatisfiable" KindClientError ErrKind = "ClientError" KindIOError ErrKind = "IOError" )
func Kind ¶
Kind determines the Kind associated with an error by inspecting the chain of errors. The top-most matching Kind is returned or KindUnknown if no Kind can be determined.
func KindMapping ¶
KindMapping determines the correct EdgeX error kind for the given HTTP response code.