apperr

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortWithError

func AbortWithError(c *gin.Context, err error)

AbortWithError adds the error to Gin's context and aborts the request

func Middleware

func Middleware(c *gin.Context)

Types

type Error

type Error struct {
	Code    int
	Message string
	Details []string
	Err     error
}

func NewBadRequestError

func NewBadRequestError(err error, args ...string) *Error

func NewConflictError

func NewConflictError(err error, args ...string) *Error

func NewDatabaseError

func NewDatabaseError(err error, args ...string) *Error

func NewForbiddenError

func NewForbiddenError(err error, args ...string) *Error

func NewInternalServerError

func NewInternalServerError(err error, args ...string) *Error

func NewNotFoundError

func NewNotFoundError(err error, args ...string) *Error

func NewTooManyRequestsError

func NewTooManyRequestsError(err error, args ...string) *Error

TODO (pipo) : could we use the stack, instead of the heap?

func NewUnauthorizedError

func NewUnauthorizedError(err error, args ...string) *Error

func NewValidationError

func NewValidationError(err error, args ...string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Log

func (e *Error) Log(c *gin.Context)

type ErrorDetail

type ErrorDetail struct {
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Details []string `json:"details,omitempty"`
}

TODO (pipo): do we really need this struct ? (1)

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetail `json:"error"`
}

TODO (pipo): do we really need this struct ? (2)

Jump to

Keyboard shortcuts

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