apierrors

package
v0.0.0-...-081ecb4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound            = errors.New("no data")
	ErrBadRequest          = errors.New("bad request")
	ErrInternal            = errors.New("interal error")
	ErrNotAuthorized error = BaseRichError{
		HTTPCode:     http.StatusForbidden,
		ErrorCode:    "NOT_AUTHORIZED",
		DebugMessage: "not authorized",
	}
)

Functions

func IsErrorLikeResult

func IsErrorLikeResult(err error) bool

func NewForbiddenError

func NewForbiddenError(code string) error

Types

type BaseRichError

type BaseRichError struct {
	HTTPCode     int
	ErrorCode    string
	UserMessage  string
	DebugMessage string
}

func (BaseRichError) Error

func (e BaseRichError) Error() string

func (BaseRichError) GetCode

func (e BaseRichError) GetCode() string

func (BaseRichError) GetHTTPCode

func (e BaseRichError) GetHTTPCode() int

func (BaseRichError) GetMessage

func (e BaseRichError) GetMessage() string

type ContinueError

type ContinueError struct {
	URL string `json:"continueUrl"`
}

ContinueError behaves like RedirectError but instead it's API friendly and uses status code 202 with json body.

func NewContinueError

func NewContinueError(url string) *ContinueError

func (ContinueError) Error

func (e ContinueError) Error() string

func (ContinueError) IsErrorLikeResult

func (e ContinueError) IsErrorLikeResult() bool

type ErrorLikeResult

type ErrorLikeResult interface {
	IsErrorLikeResult() bool
}

type ErrorWithCode

type ErrorWithCode interface {
	GetCode() string
}

type ErrorWithHTTPCode

type ErrorWithHTTPCode interface {
	GetHTTPCode() int
}

type LocalizedError

type LocalizedError interface {
	GetMessage() string
}

type NotAcceptableError

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

func NewNotAcceptableError

func NewNotAcceptableError(code string) *NotAcceptableError

func (NotAcceptableError) Error

func (e NotAcceptableError) Error() string

func (NotAcceptableError) GetCode

func (e NotAcceptableError) GetCode() string

func (NotAcceptableError) GetMessage

func (e NotAcceptableError) GetMessage() string

func (NotAcceptableError) WithMessage

func (e NotAcceptableError) WithMessage(format string, args ...interface{}) *NotAcceptableError

type PendingError

type PendingError struct{}

func (PendingError) Error

func (e PendingError) Error() string

func (PendingError) IsErrorLikeResult

func (e PendingError) IsErrorLikeResult() bool

type RaceConditionError

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

func NewRaceConditionError

func NewRaceConditionError(m string) *RaceConditionError

func (RaceConditionError) Error

func (e RaceConditionError) Error() string

func (RaceConditionError) GetMessage

func (e RaceConditionError) GetMessage() string

type RedirectError

type RedirectError struct {
	Temporary bool
	URL       string
}

func NewTemporaryRedirectError

func NewTemporaryRedirectError(url string) *RedirectError

func (RedirectError) Error

func (e RedirectError) Error() string

func (RedirectError) IsErrorLikeResult

func (e RedirectError) IsErrorLikeResult() bool

Jump to

Keyboard shortcuts

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