ex

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadRequest       = New(http.StatusBadRequest, "bad request")
	Unauthorized     = New(http.StatusUnauthorized, "unauthorized")
	Forbidden        = New(http.StatusForbidden, "forbidden")
	NotFound         = New(http.StatusNotFound, "not found")
	MethodNotAllowed = New(http.StatusMethodNotAllowed, "method not allowed")
	Conflict         = New(http.StatusConflict, "conflict")
	Internal         = New(http.StatusInternalServerError, "internal server error")
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int    `json:"code" xml:"code"`
	Message string `json:"message,omitempty" xml:"message,omitempty"`

	Metadata map[string]any `json:"metadata,omitempty" xml:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(code int, s string, v ...any) *Error

func (*Error) AppendMetadata

func (e *Error) AppendMetadata(kvs ...any) *Error

func (*Error) Error

func (e *Error) Error() (s string)

func (*Error) WithMessage

func (e *Error) WithMessage(s string, v ...any) *Error

func (*Error) WithMetadata

func (e *Error) WithMetadata(kvs ...any) *Error

Jump to

Keyboard shortcuts

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