Documentation
¶
Index ¶
- func ErrorStorage() map[int]string
- func Init(errors map[int]string)
- type Error
- func (e *Error) Error() string
- func (e *Error) FormatMessage(args ...any)
- func (e *Error) GetCode() int
- func (e *Error) GetHTTPMessage() string
- func (e *Error) GetHTTPStatus() int
- func (e *Error) GetMessage() string
- func (e *Error) JSON() string
- func (e *Error) JSONOrigin() string
- func (e *Error) SetCode(code int)
- func (e *Error) SetDetail(name, data string)
- func (e *Error) SetError(err *MiniError)
- func (e *Error) SetHTTPStatus(code int)
- func (e *Error) SetMessage(msg string, format ...any)
- type ErrorHandler
- type ErrorOption
- type MiniError
- type PropertySetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorStorage ¶
Types ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details"`
Errors []*MiniError `json:"errors"`
// contains filtered or unexported fields
}
func (*Error) FormatMessage ¶
func (*Error) GetHTTPMessage ¶
func (*Error) GetHTTPStatus ¶
func (*Error) GetMessage ¶
func (*Error) JSONOrigin ¶
func (*Error) SetHTTPStatus ¶
func (*Error) SetMessage ¶
type ErrorHandler ¶
type ErrorHandler interface {
JSON() string
JSONOrigin() string
Error() string
GetHTTPStatus() int
GetHTTPMessage() string
GetCode() int
GetMessage() string
}
func New ¶
func New(code int, options ...ErrorOption) ErrorHandler
type ErrorOption ¶
type ErrorOption func(PropertySetter)
func Detail ¶
func Detail(name, data string) ErrorOption
func Err ¶
func Err(miniErr *MiniError) ErrorOption
func HTTPStatus ¶
func HTTPStatus(status int) ErrorOption
func Message ¶
func Message(message string, format ...any) ErrorOption
func MessageArgs ¶
func MessageArgs(args ...any) ErrorOption
Click to show internal directories.
Click to hide internal directories.