apierrors

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrCodeInvalidRange = 800
	ErrCodeInternal     = 900
	ErrCodeUnauthorized = 700
	ErrCodeForbidden    = 701
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	ErrorCode    int
	ErrorMessage string
	Details      map[string]any
	// contains filtered or unexported fields
}

func New

func New(
	httpStatusCode int,
	errorCode int,
	errorMessage string,
	err error,
) Error

func NewBusinessError

func NewBusinessError(errorCode int, errorMessage string, err error) Error

func NewForbiddenError

func NewForbiddenError(errorMsg string) Error

func NewInternalServiceError

func NewInternalServiceError(err error) Error

func NewRangeUnacceptableError

func NewRangeUnacceptableError(errorMsg string) Error

func NewUnauthorizedError

func NewUnauthorizedError(errorMsg string) Error

func (Error) Error

func (e Error) Error() string

func (Error) HttpStatusCode added in v1.8.2

func (e Error) HttpStatusCode() int

func (Error) LogLevel

func (e Error) LogLevel() log.Level

func (Error) WithDetails

func (e Error) WithDetails(details map[string]any) Error

func (Error) WithLogLevel

func (e Error) WithLogLevel(level log.Level) Error

func (Error) WriteError

func (e Error) WriteError(w http.ResponseWriter) error

Jump to

Keyboard shortcuts

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