statuserr

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Err error
	// http status code
	Status status.Status
	// custom error code
	Code int
}

Error represents http response error, which is along with http status code, it used to decide how to show error message in response.

func BadRequest

func BadRequest(err error) Error

func Code

func Code(code int) Error

func Err

func Err(err error) Error

func Errorf

func Errorf(msg string, args ...any) Error

func Forbidden

func Forbidden(err error) Error

func InternalError

func InternalError(err error) Error

func New

func New() Error

func Status

func Status(status status.Status) Error

func UnAuthorized

func UnAuthorized(err error) Error

func (Error) Error

func (e Error) Error() string

func (Error) SetCode

func (e Error) SetCode(code int) Error

func (Error) SetError

func (e Error) SetError(err error) Error

func (Error) SetErrorf

func (e Error) SetErrorf(msg string, args ...any) Error

func (Error) SetStatus

func (e Error) SetStatus(status status.Status) Error

Jump to

Keyboard shortcuts

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