http_err

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: GPL-3.0 Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InternalServerError = ResponseErrorType{
		Code: 500000,
		Name: "Internal Server Error",
	}

	UnexpectedInternalServerError = ResponseErrorType{
		Code: 500001,
		Name: "Unexpected Internal Server Error",
	}

	InvalidArgument = ResponseErrorType{
		Code: 400000,
		Name: "Invalid Argument",
	}

	Unauthorized = ResponseErrorType{
		Code: 401000,
		Name: "Unauthorized",
	}

	Forbidden = ResponseErrorType{
		Code: 403000,
		Name: "Forbidden",
	}

	NotFound = ResponseErrorType{
		Code: 404000,
		Name: "Not Found",
	}

	NotAcceptable = ResponseErrorType{
		Code: 406000,
		Name: "Not Acceptable",
	}

	Conflict = ResponseErrorType{
		Code: 409000,
		Name: "Conflict",
	}

	ServiceUnavailable = ResponseErrorType{
		Code: 503000,
		Name: "Service Unavailable",
	}
)

Functions

This section is empty.

Types

type ResponseError

type ResponseError struct {
	Id      string `json:"id"`
	Code    int    `json:"code"`
	Name    string `json:"name"`
	Message string `json:"message"`
	Payload any    `json:"payload"`
}

func (*ResponseError) Error

func (responseError *ResponseError) Error() string

func (*ResponseError) ResponseStatusCode

func (responseError *ResponseError) ResponseStatusCode() int

type ResponseErrorType

type ResponseErrorType struct {
	Code int
	Name string
}

func (ResponseErrorType) Error

func (responseErrorType ResponseErrorType) Error() string

func (ResponseErrorType) ForceWrap

func (responseErrorType ResponseErrorType) ForceWrap(err error) error

func (ResponseErrorType) Is

func (responseErrorType ResponseErrorType) Is(err error) bool

func (ResponseErrorType) New

func (responseErrorType ResponseErrorType) New(message ...string) error

func (ResponseErrorType) NewWithPayload

func (responseErrorType ResponseErrorType) NewWithPayload(message string, payload any) error

func (ResponseErrorType) Wrap

func (responseErrorType ResponseErrorType) Wrap(err error) error

func (ResponseErrorType) WrapAndSetId

func (responseErrorType ResponseErrorType) WrapAndSetId(err error, id string) error

Jump to

Keyboard shortcuts

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