status

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCanceled           = errors.New("canceled")
	ErrUnknown            = errors.New("unknown")
	ErrInvalidArgument    = errors.New("invalid argument")
	ErrDeadlineExceeded   = errors.New("deadline exceeded")
	ErrNotFound           = errors.New("not found")
	ErrAlreadyExists      = errors.New("already exists")
	ErrPermissionDenied   = errors.New("permission denied")
	ErrResourceExhausted  = errors.New("resource exhausted")
	ErrFailedPrecondition = errors.New("failed precondition")
	ErrAborted            = errors.New("aborted")
	ErrOutOfRange         = errors.New("out of range")
	ErrUnimplemented      = errors.New("unimplemented")
	ErrInternal           = errors.New("internal")
	ErrUnavailable        = errors.New("unavailable")
	ErrDataLoss           = errors.New("data loss")
	ErrUnauthenticated    = errors.New("unauthenticated")
)

Functions

func ReadRequest

func ReadRequest[T *E, E any](c *gin.Context, req T) bool

func WriteError

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

func WriteResponse

func WriteResponse[E any](c *gin.Context, e E, err error)

func WriteResponseStatusCode

func WriteResponseStatusCode[E any](c *gin.Context, successStatusCode int, e E, err error)

Types

type Error added in v1.8.0

type Error struct {
	Status error `json:"status,omitempty"`
	Reason error `json:"reason,omitempty"`
}

func (Error) Error added in v1.8.0

func (e Error) Error() string

func (Error) Is added in v1.8.0

func (e Error) Is(err error) bool

func (*Error) MarshalJSON added in v1.8.0

func (e *Error) MarshalJSON() ([]byte, error)

func (*Error) UnmarshalJSON added in v1.8.0

func (e *Error) UnmarshalJSON(data []byte) error

func (Error) Unwrap added in v1.8.0

func (e Error) Unwrap() error

Jump to

Keyboard shortcuts

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