myerrors

package
v0.0.0-...-0e8bb44 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTemplate = "%w"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error - struct error.

Errors with status values from 4000 to 4999 are considered client errors and sent to the front ' in internal/pkg/server/delivery/handle_err.go function HandleErr. This maybe be checked with help IsErrorClient function.

Errors with status values from 5000 to 5999 are sent to the server in the same HandleErr always as internal with status = 5000

func NewErrorBadContentRequest

func NewErrorBadContentRequest(format string, args ...any) *Error

NewErrorBadContentRequest error with status = StatusBadContentRequest uses when user has entered incorrect data and needs to show him this error

func NewErrorBadFormatRequest

func NewErrorBadFormatRequest(format string, args ...any) *Error

NewErrorBadFormatRequest error with status = StatusBadFormatRequest uses when get bad request from frontend and errors with this status need frontend developer

func NewErrorCustom

func NewErrorCustom(status int, format string, args ...any) *Error

NewErrorCustom prefer this function to other NewError... from this package. Use this function only if you understand why

func NewErrorInternal

func NewErrorInternal(format string, args ...any) *Error

NewErrorInternal error with status = StatusInternalServer uses for indicates internal error status in server

func (*Error) Error

func (e *Error) Error() string

func (*Error) IsErrorClient

func (e *Error) IsErrorClient() bool

func (*Error) Status

func (e *Error) Status() int

Jump to

Keyboard shortcuts

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