Documentation
¶
Index ¶
- Variables
- type Error
- func (e *Error) AddField(key string, value any) *Error
- func (e *Error) AddFields(fields map[string]any) *Error
- func (e *Error) Clone() *Error
- func (e *Error) Error() string
- func (e *Error) HasField(key string) bool
- func (e *Error) Is(target error) bool
- func (e Error) MarshalJSON() ([]byte, error)
- func (e *Error) SetCode(code string) *Error
- func (e *Error) SetHTTPCode(httpCode int) *Error
- func (e *Error) SetMeta(data any) *Error
- func (e *Error) StatusCode() int
- func (e *Error) Unwrap() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDatabaseServerError = &Error{ HTTPCode: http.StatusInternalServerError, Err: errors.New("operation database failed"), Code: "INTERNAL_SERVER_ERROR", }
ErrDatabaseServerError internal server error
View Source
var ErrForbidden = &Error{ HTTPCode: http.StatusForbidden, Err: errors.New("forbidden"), Code: "ACCESS_IS_FORBIDDEN", }
ErrForbidden access is forbidden
View Source
var ErrInternalServerError = &Error{ HTTPCode: http.StatusInternalServerError, Err: errors.New("internal server error"), Code: "INTERNAL_SERVER_ERROR", }
ErrInternalServerError internal server error
View Source
var ErrInvalidArguments = &Error{ HTTPCode: http.StatusBadRequest, Err: errors.New("invalid arguments"), Code: "INVALID_ARGUMENTS", }
ErrInvalidArguments invalid arguments
View Source
var ErrNotFound = &Error{ HTTPCode: http.StatusNotFound, Err: errors.New("not found"), Code: "NOT_FOUND", }
ErrNotFound not found error
View Source
var ErrRequestEntityTooLarge = &Error{ HTTPCode: http.StatusRequestEntityTooLarge, Err: errors.New("request entity too large"), Code: "REQUEST_ENTITY_TOO_LARGE", }
ErrRequestEntityTooLarge request entity too large
View Source
HTTPCode: http.StatusUnauthorized, Err: errors.New("unauthorized"), Code: "UNAUTHORIZED", }
ErrUnauthorized unauthorized
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error custom error
func (Error) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Error) SetHTTPCode ¶
SetHTTPCode sets the error's http code.
Click to show internal directories.
Click to hide internal directories.