pgerr

package
v0.0.0-...-f43e618 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 2 Imported by: 0

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 Extras

type Extras map[string]any

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL