apperror

package
v0.0.0-...-c407d37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadDataError

type BadDataError struct {
	// contains filtered or unexported fields
}

BadDataError is the custom error type (exported for type checking)

func NewBadDataError

func NewBadDataError(badDataMsg string) *BadDataError

NewBadDataError creates a new BadDataError error

func (*BadDataError) Code

func (b *BadDataError) Code() ErrorCode

Code returns the error code enum

func (*BadDataError) Error

func (b *BadDataError) Error() string

type ConflictError

type ConflictError struct {
	// contains filtered or unexported fields
}

ConflictError is returned when a given struct is not found

func NewConflictError

func NewConflictError(id uuid.UUID, message string) ConflictError

NewConflictError returns an error for when a struct can not be found

func (ConflictError) Error

func (e ConflictError) Error() string

type ContextError

type ContextError struct {
	// contains filtered or unexported fields
}

ContextError is returned when there was an issue with the context passed into a function (Often an environment error)

func NewContextError

func NewContextError(message string) ContextError

NewContextError creates an error for a problem with the context

func (ContextError) Error

func (e ContextError) Error() string

type Error

type Error interface {
	error
	Code() ErrorCode
}

Error is used for handling errors from the Route package

type ErrorCode

type ErrorCode string

ErrorCode contains error codes for the route package

const BadDataCode ErrorCode = "BAD_DATA"

BadDataCode catches errors that are due to bad data being sent and is specifically not a server side error

const UnsupportedPostalCode ErrorCode = "UNSUPPORTED_POSTAL_CODE"

UnsupportedPostalCode happens when we don't have the data to support a given postal code.

type EventError

type EventError struct {
	// contains filtered or unexported fields
}

EventError is an error generated in the events/notifications system. We should log but not return this sort of error to the client because client's request could be successful but our notification subsystem encountered an error

func NewEventError

func NewEventError(message string, err error) EventError

NewEventError returns a new EventError

func (EventError) Error

func (e EventError) Error() string

Error is the string representation of the EventError

func (EventError) Unwrap

func (e EventError) Unwrap() error

Unwrap returns the wrapped error, could be nil

type ForbiddenError

type ForbiddenError struct {
	// contains filtered or unexported fields
}

ForbiddenError is the forbidden error

func NewForbiddenError

func NewForbiddenError(message string) ForbiddenError

NewForbiddenError returns an error for forbidden

func (ForbiddenError) Error

func (e ForbiddenError) Error() string

Error is the string representation of the forbidden error

type ImplementationError

type ImplementationError struct {
	// contains filtered or unexported fields
}

ImplementationError is returned when a type or function has been implemented incorrectly (Typically a dev error)

func NewImplementationError

func NewImplementationError(message string) ImplementationError

NewImplementationError creates an error for some unimplemented functionality

func (ImplementationError) Error

func (e ImplementationError) Error() string

type InternalServerError

type InternalServerError struct {
	// contains filtered or unexported fields
}

Generic InternalServerError for internal errors that aren't covered by other, more specific errors

func NewInternalServerError

func NewInternalServerError(message string) InternalServerError

NewSessionError returns a new InternalServerError

func (InternalServerError) Error

func (e InternalServerError) Error() string

Error is the string representation of the InternalServerError

type InvalidCreateInputError

type InvalidCreateInputError struct {
	ValidationErrors *validate.Errors
	// contains filtered or unexported fields
}

InvalidCreateInputError is returned when an update fails a validation rule

func NewInvalidCreateInputError

func NewInvalidCreateInputError(validationErrors *validate.Errors, message string) InvalidCreateInputError

NewInvalidCreateInputError returns an error for invalid input

func (InvalidCreateInputError) Error

func (e InvalidCreateInputError) Error() string

type InvalidInputError

type InvalidInputError struct {
	ValidationErrors *validate.Errors
	// contains filtered or unexported fields
}

InvalidInputError is returned when an update fails a validation rule

func NewInvalidInputError

func NewInvalidInputError(id uuid.UUID, err error, validationErrors *validate.Errors, message string) InvalidInputError

NewInvalidInputError returns an error for invalid input

func (InvalidInputError) Error

func (e InvalidInputError) Error() string

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

NotFoundError is returned when a given struct is not found

func NewNotFoundError

func NewNotFoundError(id uuid.UUID, message string) NotFoundError

NewNotFoundError returns an error for when a struct can not be found

func (NotFoundError) Error

func (e NotFoundError) Error() string

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

Unwrap returns the wrapped error, could be nil

func (*NotFoundError) Wrap

func (e *NotFoundError) Wrap(err error)

Wrap lets the caller add an error to be wrapped in the NotFoundError

type NotImplementedError

type NotImplementedError struct {
	// contains filtered or unexported fields
}

NotImplementedError is returned when some functionality is not yet implemented

func NewNotImplementedError

func NewNotImplementedError(message string) NotImplementedError

NewNotImplementedError creates an error for some unimplemented functionality

func (NotImplementedError) Error

func (e NotImplementedError) Error() string

type PPMNoWeightTicketsError

type PPMNoWeightTicketsError struct {
	// contains filtered or unexported fields
}

func NewPPMNoWeightTicketsError

func NewPPMNoWeightTicketsError(id uuid.UUID, message string) PPMNoWeightTicketsError

NewNotFoundError returns an error for when a struct can not be found

func (PPMNoWeightTicketsError) Error

func (e PPMNoWeightTicketsError) Error() string

type PPMNotReadyForCloseoutError

type PPMNotReadyForCloseoutError struct {
	// contains filtered or unexported fields
}

func NewPPMNotReadyForCloseoutError

func NewPPMNotReadyForCloseoutError(id uuid.UUID, message string) PPMNotReadyForCloseoutError

NewNotFoundError returns an error for when a struct can not be found

func (PPMNotReadyForCloseoutError) Error

type PreconditionFailedError

type PreconditionFailedError struct {
	// contains filtered or unexported fields
}

PreconditionFailedError is the precondition failed error

func NewPreconditionFailedError

func NewPreconditionFailedError(id uuid.UUID, err error) PreconditionFailedError

NewPreconditionFailedError returns an error for a failed precondition

func (PreconditionFailedError) Error

func (e PreconditionFailedError) Error() string

Error is the string representation of the precondition failed error

type QueryError

type QueryError struct {
	// contains filtered or unexported fields
}

QueryError is returned when a query in the database failed. Use InvalidInputError if you have validation errors to report. QueryError is used if you passed validation but the query still failed.

func NewQueryError

func NewQueryError(objectType string, err error, msgOverride string) QueryError

NewQueryError returns an error on a query to the database It will create a default error message based on the objectType You can override the default message with the msgOverride param

func (QueryError) Error

func (e QueryError) Error() string

func (*QueryError) Unwrap

func (e *QueryError) Unwrap() error

Unwrap returns the enclosed error

type SessionError

type SessionError struct {
	// contains filtered or unexported fields
}

We should log Session Errors generated in the Handlers

func NewSessionError

func NewSessionError(message string) SessionError

NewSessionError returns a new SessionError

func (SessionError) Error

func (e SessionError) Error() string

Error is the string representation of the SessionError

type UnprocessableEntityError

type UnprocessableEntityError struct {
	// contains filtered or unexported fields
}

We should log Unprocessable Entity Errors generated in the Handlers

func NewUnprocessableEntityError

func NewUnprocessableEntityError(message string) UnprocessableEntityError

NewUnprocessableEntityError returns a new UnprocessableEntityError

func (UnprocessableEntityError) Error

func (e UnprocessableEntityError) Error() string

Error is the string representation of the UnprocessableEntityError

type UnsupportedPostalCodeError

type UnsupportedPostalCodeError struct {
	// contains filtered or unexported fields
}

UnsupportedPostalCodeError is the custom error type (exported for type checking)

func NewUnsupportedPostalCodeError

func NewUnsupportedPostalCodeError(postalCode string, reason string) *UnsupportedPostalCodeError

NewUnsupportedPostalCodeError creates an error for when we don't have the data to support a given postal code.

func (*UnsupportedPostalCodeError) Code

func (b *UnsupportedPostalCodeError) Code() ErrorCode

Code returns the error code enum

func (*UnsupportedPostalCodeError) Error

type UpdateError

type UpdateError struct {
	// contains filtered or unexported fields
}

UpdateError is returned when a service cannot be updated

func NewUpdateError

func NewUpdateError(id uuid.UUID, message string) UpdateError

NewUpdateError returns an error for when a service cannot be updated

func (UpdateError) Error

func (e UpdateError) Error() string

func (*UpdateError) Unwrap

func (e *UpdateError) Unwrap() error

Unwrap returns the wrapped error, could be nil

func (*UpdateError) Wrap

func (e *UpdateError) Wrap(err error)

Wrap lets the caller add an error to be wrapped in the NewUpdateError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL