errors

package
v0.0.93 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultErrorContentTypeResponses = []string{
	"application/json",
	"application/xml",
	"multipart/form-data",
}
View Source
var DefaultErrorResponses = map[int]HTTPError{
	http.StatusBadRequest:          newErrorResponse(uuid.NewString(), http.StatusBadRequest, "Bad Request"),
	http.StatusInternalServerError: newErrorResponse(uuid.NewString(), http.StatusInternalServerError, "Internal Server Error"),
}

Functions

This section is empty.

Types

type HTTPError

type HTTPError struct {
	ID      string `form:"id"      json:"id"      xml:"id"`
	Status  int    `form:"status"  json:"status"  xml:"status"`
	Message string `form:"message" json:"message" xml:"message"`
}

func NewBadRequestError

func NewBadRequestError(message ...string) HTTPError

func NewConflictError

func NewConflictError(message ...string) HTTPError

func NewError

func NewError(status int, message ...string) HTTPError

func NewInternalServerError

func NewInternalServerError(message ...string) HTTPError

func NewNotFoundError

func NewNotFoundError(message ...string) HTTPError

func NewUnauthorizedError

func NewUnauthorizedError(message ...string) HTTPError

func (HTTPError) Description

func (e HTTPError) Description() string

func (HTTPError) Error

func (e HTTPError) Error() string

func (HTTPError) SetMessage

func (e HTTPError) SetMessage(message string) HTTPError

func (HTTPError) StatusCode

func (e HTTPError) StatusCode() int

Jump to

Keyboard shortcuts

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