Documentation ¶
Index ¶
- Constants
- Variables
- func Is(err, target error) bool
- func IsNotFount(err error) bool
- func LackParameterError(name string) error
- func New(text string) error
- func WithMessage(err error, msg string) error
- type MultipleServerError
- func (m *MultipleServerError) Append(err error)
- func (m MultipleServerError) Code() string
- func (m MultipleServerError) Error() string
- func (m MultipleServerError) HasError() bool
- func (m MultipleServerError) MarshalJSON() ([]byte, error)
- func (m MultipleServerError) StatusCode() int
- func (m MultipleServerError) String() string
- type ServerError
Constants ¶
View Source
const ( CodeSystemError = "E0000" CodeInvalidCredentials = "E0001" CodeUserDisable = "E0002" CodeUserStatusUnknown = "E0003" CodeUserNeedResetPassword = "E0004" CodeUserInactive = "E0005" CodeTooManyLoginFailures = "E0006" CodePasswordBaseGeneralTooSimple = "E0010" CodePasswordBaseSafeTooSimple = "E0011" CodePasswordBaseVerySafeTooSimple = "E0012" CodePasswordCannotContainUsername = "E0013" CodePasswordTooShort = "E0014" CodePasswordRepetition = "E0015" CodePasswordTooSimple = "E0016" CodeRequestTooFrequently = "E0429" CodeAppMemberCannotBeEmpty = "E1101" CodeAppCannotBeDelete = "E1102" )
Variables ¶
View Source
var ( InternalServerError = func() error { return NewServerError(http.StatusInternalServerError, "Internal server error") } NotLoginError = func() error { return NewServerError(http.StatusInternalServerError, "Not logged in") } BadRequestError = func() error { return NewServerError(http.StatusBadRequest, "Invalid Request") } ParameterError = func(msg string) error { return NewServerError(http.StatusBadRequest, "Parameter Error: "+msg) } StatusNotFound = func(name string) ServerError { return NewServerError(http.StatusNotFound, name+" Not Found") } StatusForbidden = func(name string) ServerError { return NewServerError(http.StatusForbidden, name+" StatusForbidden") } NotFoundError = func() error { return NewServerError(http.StatusNotFound, "record not found") } )
Functions ¶
func IsNotFount ¶
func LackParameterError ¶
func WithMessage ¶
Types ¶
type MultipleServerError ¶
type MultipleServerError struct {
// contains filtered or unexported fields
}
func NewMultipleServerError ¶
func NewMultipleServerError(status int, prefix string, code ...string) *MultipleServerError
func (*MultipleServerError) Append ¶
func (m *MultipleServerError) Append(err error)
func (MultipleServerError) Code ¶
func (m MultipleServerError) Code() string
func (MultipleServerError) Error ¶
func (m MultipleServerError) Error() string
func (MultipleServerError) HasError ¶
func (m MultipleServerError) HasError() bool
func (MultipleServerError) MarshalJSON ¶
func (m MultipleServerError) MarshalJSON() ([]byte, error)
func (MultipleServerError) StatusCode ¶
func (m MultipleServerError) StatusCode() int
func (MultipleServerError) String ¶
func (m MultipleServerError) String() string
type ServerError ¶
func NewServerError ¶
func NewServerError(status int, msg string, code ...string) ServerError
func WithServerError ¶
func WithServerError(status int, err error, msg string, code ...string) ServerError
Click to show internal directories.
Click to hide internal directories.