response

package
v0.5.34 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequestError

func BadRequestError(c echo.Context, err error) error

func ErrorCodeStrings

func ErrorCodeStrings() []string

ErrorCodeStrings returns a slice of all String values of the enum

func InternalError

func InternalError(c echo.Context) error

InternalError should not return the details of the error to the client for safety reasons.

func ValidationFailedError added in v0.5.7

func ValidationFailedError(c echo.Context, err error) error

Types

type ErrorCode

type ErrorCode int
const (
	ErrorCodeBadRequest ErrorCode = iota + 1
	ErrorCodeValidationFailed
	ErrorCodeBadParams
	ErrorCodeInternalError
)

func ErrorCodeString

func ErrorCodeString(s string) (ErrorCode, error)

ErrorCodeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ErrorCodeValues

func ErrorCodeValues() []ErrorCode

ErrorCodeValues returns all values of the enum

func (ErrorCode) IsAErrorCode

func (i ErrorCode) IsAErrorCode() bool

IsAErrorCode returns "true" if the value is listed in the enum definition. "false" otherwise

func (ErrorCode) MarshalJSON

func (i ErrorCode) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ErrorCode

func (ErrorCode) String

func (i ErrorCode) String() string

func (*ErrorCode) UnmarshalJSON

func (i *ErrorCode) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ErrorCode

func (ErrorCode) Values

func (ErrorCode) Values() []string

type ErrorResponse

type ErrorResponse struct {
	Message string    `json:"message"`
	Code    ErrorCode `json:"code"`
}

Jump to

Keyboard shortcuts

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