Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserNotFound = NewCustomError(NotFound, "user not found", nil) ErrFindingUsers = NewCustomError(InternalError, "error finding users", nil) ErrFindingUserByID = NewCustomError(InternalError, "error finding user by id", nil) ErrCreatingUser = NewCustomError(InternalError, "error creating user", nil) ErrUpdatingUser = NewCustomError(InternalError, "error updating user", nil) ErrDeletingUser = NewCustomError(InternalError, "error deleting user", nil) ErrValidatingUser = NewCustomError(InvalidFormat, "invalid user", nil) )
Functions ¶
This section is empty.
Types ¶
type CustomError ¶
type CustomError struct { Code ErrorCode `json:"code"` Message string `json:"message"` Err error `json:"detail,omitempty"` }
CustomError represents a more detailed error with a message and code
func NewCustomError ¶
func NewCustomError(code ErrorCode, message string, err error) *CustomError
NewCustomError creates a new CustomError
func (*CustomError) Error ¶
func (e *CustomError) Error() string
Error implements the error interface for CustomError
func (*CustomError) MarshalJSON ¶
func (e *CustomError) MarshalJSON() ([]byte, error)
func (*CustomError) SetDetail ¶
func (e *CustomError) SetDetail(err error) *CustomError
func (*CustomError) SetDetailFromString ¶
func (e *CustomError) SetDetailFromString(err string) *CustomError
func (*CustomError) Unwrap ¶
func (e *CustomError) Unwrap() error
Unwrap allows errors.Is and errors.As to work with CustomError
Click to show internal directories.
Click to hide internal directories.