Documentation
¶
Index ¶
Constants ¶
View Source
const ( CodeNotFound = "NOT_FOUND" CodeInvalidRequest = "INVALID_REQUEST" CodeInternalError = "INTERNAL_ERROR" )
Variables ¶
View Source
var ( // ErrNotFound is returned when a resource is not found. ErrNotFound = New(fiber.StatusBadRequest, CodeNotFound, "resource not found with given parameters") // ErrInvalidReq is returned when a request is invalid. ErrInvalidReq = New(fiber.StatusBadRequest, CodeInvalidRequest, "invalid request: some or all request parameters are invalid") // ErrInternalError is returned when an internal error occurs. ErrInternalError = New(fiber.StatusInternalServerError, CodeInternalError, "internal server error occurred") ErrInternalErrorImmutable = NewImmutable(fiber.StatusInternalServerError, CodeInternalError, "internal server error occurred") )
Functions ¶
This section is empty.
Types ¶
type PenguinError ¶
type PenguinError struct { StatusCode int `json:"-" swaggerignore:"true"` ErrorCode string `json:"code" example:"INVALID_REQUEST"` Message string `json:"message" example:"invalid request: some or all request parameters are invalid"` Extras *Extras `json:"-"` }
func New ¶
func New(statusCode int, errorCode, message string) *PenguinError
func NewImmutable ¶
func NewImmutable(statusCode int, errorCode, message string) PenguinError
func NewInvalidViolations ¶
func NewInvalidViolations(violations any) *PenguinError
func (*PenguinError) Error ¶
func (e *PenguinError) Error() string
func (PenguinError) Msg ¶
func (e PenguinError) Msg(format string, parts ...any) *PenguinError
func (PenguinError) WithExtras ¶
func (e PenguinError) WithExtras(extras Extras) *PenguinError
Click to show internal directories.
Click to hide internal directories.