Documentation ¶
Index ¶
- func As(err error, target interface{}) bool
- func Cause(err error) error
- func GetStackTraceForError(err error) errors.StackTrace
- func HTTPCodeForError(err error) int
- func Is(err, target error) bool
- func Unwrap(err error) error
- type GetStackTrace
- type HTTPCode
- type MultiError
- type StatusError
- func NewAdminRoleNotAssumable(role string, err error) *StatusError
- func NewAlreadyExists(group string, name string) *StatusError
- func NewBadRequest(m string) *StatusError
- func NewConflict(group string, name string, err error) *StatusError
- func NewGenericStatusError(statusCode int, err error) *StatusError
- func NewInternalServer(m string, err error) *StatusError
- func NewNotFound(group string, name string) *StatusError
- func NewServiceUnavailable(m string) *StatusError
- func NewUnathorizedError(m string) *StatusError
- func NewValidation(group string, err error) *StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStackTraceForError ¶
func GetStackTraceForError(err error) errors.StackTrace
GetStackTraceForError returns the HTTP status for a particular error.
func HTTPCodeForError ¶
HTTPCodeForError returns the HTTP status for a particular error.
Types ¶
type GetStackTrace ¶
type GetStackTrace interface {
StackTrace() errors.StackTrace
}
GetStackTrace returns the API Code
type MultiError ¶
MultiError is an Error type that wraps multiple errors. This can be a useful way to combine errors in a method where you want to allow process to continue through multiple failed steps.
func NewMultiError ¶
func NewMultiError(msg string, errs []error) *MultiError
NewMultiError is a list of errors
func (MultiError) Error ¶
func (e MultiError) Error() string
Error returns the error message to satisfy the error interface
func (MultiError) Is ¶
func (e MultiError) Is(err error) bool
Is to satisfy the error comparison interface
type StatusError ¶
type StatusError struct { Details detailError `json:"error"` // contains filtered or unexported fields }
StatusError is the custom error type we are using. Should satisfy errors interface
func NewAdminRoleNotAssumable ¶
func NewAdminRoleNotAssumable(role string, err error) *StatusError
NewAdminRoleNotAssumable returns a new error representing an admin role not being assumable
func NewAlreadyExists ¶
func NewAlreadyExists(group string, name string) *StatusError
NewAlreadyExists returns a new error representing an already exists error
func NewBadRequest ¶
func NewBadRequest(m string) *StatusError
NewBadRequest returns a new error representing a bad request
func NewConflict ¶
func NewConflict(group string, name string, err error) *StatusError
NewConflict returns a new error for representing Conflicts
func NewGenericStatusError ¶
func NewGenericStatusError(statusCode int, err error) *StatusError
NewGenericStatusError creates an error from a generic set of information
func NewInternalServer ¶
func NewInternalServer(m string, err error) *StatusError
NewInternalServer returns an error for Internal Server Errors
func NewNotFound ¶
func NewNotFound(group string, name string) *StatusError
NewNotFound returns an a NotFound error with standard messaging
func NewServiceUnavailable ¶
func NewServiceUnavailable(m string) *StatusError
NewServiceUnavailable returns a new error representing service unavailable
func NewUnathorizedError ¶
func NewUnathorizedError(m string) *StatusError
NewUnathorizedError returns an a NewUnathorizedError error with standard messaging
func NewValidation ¶
func NewValidation(group string, err error) *StatusError
NewValidation creates a validation error
func (StatusError) Error ¶
func (e StatusError) Error() string
func (StatusError) Format ¶
func (e StatusError) Format(s fmt.State, verb rune)
Format for the standard format library
func (StatusError) Is ¶
func (e StatusError) Is(err error) bool
Is checks to see if the errors match
func (StatusError) OriginalError ¶
func (e StatusError) OriginalError() error
OriginalError provides the underlying error
func (StatusError) StackTrace ¶
func (e StatusError) StackTrace() errors.StackTrace
StackTrace returns the frames for a stack trace