apierr

package
v0.0.0-...-1ad4281 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InvalidRequestParams 400
	InvalidRequestParams = New("invalid-request-parameters")
	// NotFound 404
	NotFound = New("not-found")
	// Unauthorized403 because not using www-Authenticate headers
	Unauthorized403 = New("unauthorized-403")
	// UnprocessableEntity 422
	UnprocessableEntity = New("unprocessable-entity")
	// TooManyRequests 429
	TooManyRequests = New("too-many-requests")
)
View Source
var SomethingWentWrong = New("something-went-wrong")

SomethingWentWrong 500

Functions

func Err400

func Err400(c *fiber.Ctx, data interface{}) error

Err400 400 Bad Request

func Err401

func Err401(c *fiber.Ctx, wwwAuth string, data interface{}) error

Err401 401 Unauthorized

func Err403

func Err403(c *fiber.Ctx, data interface{}) error

Err403 403 Forbidden

func Err404

func Err404(c *fiber.Ctx, data interface{}) error

Err404 404 Not Found

func Err422

func Err422(c *fiber.Ctx, data interface{}) error

Err422 Unprocessable Entity

func Err429

func Err429(c *fiber.Ctx, data interface{}) error

Err429 Too Many Requests

func Err500

func Err500(c *fiber.Ctx, data interface{}) error

Err500 middleware

func ErrInvalidRequestParams

func ErrInvalidRequestParams(c *fiber.Ctx) error

ErrInvalidRequestParams 400

func ErrNotFound

func ErrNotFound(c *fiber.Ctx) error

ErrNotFound 404

func ErrSomethingWentWrong

func ErrSomethingWentWrong(c *fiber.Ctx) error

ErrSomethingWentWrong 500

func ErrTooManyRequests

func ErrTooManyRequests(c *fiber.Ctx) error

ErrTooManyRequests 429

func ErrUnauthorized403

func ErrUnauthorized403(c *fiber.Ctx) error

ErrUnauthorized403 403

func ErrUnprocessableEntity

func ErrUnprocessableEntity(c *fiber.Ctx) error

ErrUnprocessableEntity 422

Types

type APIErr

type APIErr struct {
	Err interface{} `json:"error"`
}

APIErr struct with error

func New

func New(data interface{}) APIErr

New Create An json compatable response error

func (*APIErr) AppendStr

func (e *APIErr) AppendStr(s string) error

AppendStr append string to Err if is string

func (*APIErr) Empty

func (e *APIErr) Empty() bool

Empty is error empty

func (*APIErr) MarshalStr

func (e *APIErr) MarshalStr() (string, error)

MarshalStr APIErr

func (*APIErr) String

func (e *APIErr) String() string

Jump to

Keyboard shortcuts

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