server_errors

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonParseError = "Parsing JSON"
)

Variables

This section is empty.

Functions

func LogAndSendServerError

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

func SendBadRequest added in v0.8.1

func SendBadRequest(c *gin.Context, message string)

func SendBadRequestFieldError added in v0.16.0

func SendBadRequestFieldError(c *gin.Context, se *ServerError)

func SendBadRequestFromError added in v0.8.1

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

func SendUnprocessableEntity added in v0.8.1

func SendUnprocessableEntity(c *gin.Context, message string)

func SendUnprocessableEntityFromError added in v0.8.1

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

func WrapLogAndSendServerError added in v0.7.0

func WrapLogAndSendServerError(c *gin.Context, err error, message string)

Types

type ServerError

type ServerError struct {
	Errors struct {
		Fields map[string][]string `json:"fields"`
		Server []string            `json:"server"`
	} `json:"errors"`
}

func SingleFieldError

func SingleFieldError(field string, fieldError string) *ServerError

func SingleServerError

func SingleServerError(serverErrorDescription string) *ServerError

func (*ServerError) AddFieldError

func (se *ServerError) AddFieldError(field string, fieldError string)

func (*ServerError) AddServerError

func (se *ServerError) AddServerError(serverErrorDescription string)

Jump to

Keyboard shortcuts

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