Documentation ¶
Overview ¶
Package errors provides an interface for all errors returned from Tharsis.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorMessage ¶
ErrorMessage returns the messages associated with the error
func IsContextCanceledError ¶ added in v0.14.0
IsContextCanceledError returns true if the error is a context.Canceled error
Types ¶
type CodeType ¶ added in v0.15.0
type CodeType string
CodeType is used to specify the type of error
const ( EInternal CodeType = "internal error" ENotImplemented CodeType = "not implemented" ENotFound CodeType = "not found" EConflict CodeType = "conflict" EOptimisticLock CodeType = "optimistic lock" EInvalid CodeType = "invalid" EForbidden CodeType = "forbidden" ETooManyRequests CodeType = "too many requests" ETooLarge CodeType = "request too large" )
Error code constants
type Option ¶ added in v0.15.0
type Option func(*config)
Option is is used to configure a TharsisError.
func WithErrorCode ¶ added in v0.15.0
WithErrorCode sets the error code on the TharsisError.
type TharsisError ¶
type TharsisError struct {
// contains filtered or unexported fields
}
TharsisError is the internal error implementation for the Tharsis API
func New ¶
func New(format string, a ...any) *TharsisError
New returns a new Tharsis error with the code and message fields set
func Wrap ¶
func Wrap(err error, format string, a ...any) *TharsisError
Wrap returns a new TharsisError which wraps an existing error
func (*TharsisError) Error ¶
func (e *TharsisError) Error() string
Error implements the error interface by writing out the recursive messages.
func (*TharsisError) Unwrap ¶ added in v0.15.1
func (e *TharsisError) Unwrap() error
Unwrap returns the wrapped error, if any.