errors

package
v0.0.0-...-5c36ebe Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ResponseDataError = "Unexpected error during response data encoding"

ResponseDataError is used as the error message when the responses functions return an error

Variables

This section is empty.

Functions

func NewErrorf

func NewErrorf(code ErrorCode, format string, a ...interface{}) error

NewErrorf function constructs Error data structure with numeric error code, and message.

func WrapErrorf

func WrapErrorf(orig error, code ErrorCode, format string, a ...interface{}) error

WrapErrorf function constructs Error data structure with original error object, numeric error code, and message.

Types

type AuthenticationError

type AuthenticationError struct {
	ErrString string
}

AuthenticationError happens during auth problems, for example malformed token

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

Error method transforms error structure to a string representation

type Error

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

Error data structure contains the original error object + assigned error code

func (*Error) Code

func (e *Error) Code() ErrorCode

Code method returns numeric error code

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap will return the original error

type ErrorCode

type ErrorCode uint

ErrorCode is enumeration type to specify numeric error code

const (
	// ErrorCodeUnknown represents numeric error code for unknown error
	ErrorCodeUnknown ErrorCode = iota

	// ErrorCodeNotFound represents numeric error code for error that
	// occurs when the rule data are not found
	ErrorCodeNotFound

	// ErrorCodeInvalidArgument represents numeric error code for error
	// that occurs when invalid argument is provided in request
	ErrorCodeInvalidArgument
)

type ForbiddenError

type ForbiddenError struct {
	ErrString string
}

ForbiddenError means user does not have permission to do a particular action, for example the account belongs to a different organization

func (*ForbiddenError) Error

func (e *ForbiddenError) Error() string

Error method transforms error structure to a string representation

type NoBodyError

type NoBodyError struct{}

NoBodyError error meaning that client didn't provide body when it's required

func (*NoBodyError) Error

func (*NoBodyError) Error() string

type RouterMissingParamError

type RouterMissingParamError struct {
	ParamName string
}

RouterMissingParamError missing parameter in request

func (*RouterMissingParamError) Error

func (e *RouterMissingParamError) Error() string

Error method transforms error structure to a string representation

type RouterParsingError

type RouterParsingError struct {
	ParamName  string
	ParamValue interface{}
	ErrString  string
}

RouterParsingError parsing error, for example string when we expected integer

func (*RouterParsingError) Error

func (e *RouterParsingError) Error() string

Error method transforms error structure to a string representation

type UnauthorizedError

type UnauthorizedError struct {
	ErrString string
}

UnauthorizedError means server can't authorize you, for example the token is missing or malformed

func (*UnauthorizedError) Error

func (e *UnauthorizedError) Error() string

Error method transforms error structure to a string representation

type ValidationError

type ValidationError struct {
	ParamName  string
	ParamValue interface{}
	ErrString  string
}

ValidationError validation error, for example when string is longer then expected

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error method transforms error structure to a string representation

Jump to

Keyboard shortcuts

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