xerr

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StatusBadRequest          = http.StatusBadRequest
	StatusInternalServerError = http.StatusInternalServerError
	StatusForbidden           = http.StatusForbidden
	StatusNotFound            = http.StatusNotFound
)

Variables

This section is empty.

Functions

func GetHTTPStatus added in v1.0.7

func GetHTTPStatus(err error) int

func GetMessage

func GetMessage(err error) string

func WithErrMsgf

func WithErrMsgf(err error, errMsg string, args ...interface{}) *customError

func WithMsg

func WithMsg(err error, msg string) *customError

func WithStatus

func WithStatus(err error, status int) *customError

Types

type ErrorType

type ErrorType uint
const (
	NoType ErrorType = iota
	BadParam
	NoRecord
	Forbidden
	DB
	Email
)

func GetType

func GetType(err error) ErrorType

GetType returns the error type

func (ErrorType) New

func (errorType ErrorType) New(errMsg string, args ...interface{}) *customError

func (ErrorType) Wrap

func (errorType ErrorType) Wrap(err error) *customError

func (ErrorType) Wrapf

func (errorType ErrorType) Wrapf(err error, errMsg string, args ...interface{}) *customError

type Status

type Status int

Jump to

Keyboard shortcuts

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