errorhandlers

package
v0.0.0-...-a1eeba1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGrpcErrorFromFieldErrors

func CreateGrpcErrorFromFieldErrors(fieldErrors map[string]FieldError) error

func HandleError

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

func NewGrpcBadRequestError

func NewGrpcBadRequestError(message string) error

func NewGrpcInternalError

func NewGrpcInternalError() error

func NewGrpcNotFoundError

func NewGrpcNotFoundError(message string) error

Types

type APIError

type APIError struct {
	Meta   Meta         `json:"meta"`
	Errors []FieldError `json:"errors,omitempty"`
}

func NewAPIError

func NewAPIError(status int, message string, errors ...FieldError) *APIError

func NewHttpBadRequestError

func NewHttpBadRequestError() *APIError

func NewHttpInternalError

func NewHttpInternalError() *APIError

func (*APIError) Error

func (v *APIError) Error() string

type FieldError

type FieldError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Field   string `json:"field,omitempty"`
}

type Meta

type Meta struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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