errors

package
v0.0.0-...-e246b8e Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotFound     errorCode = 1
	BadInput     errorCode = 2
	Internal     errorCode = 3
	Timeout      errorCode = 4
	Unauthorized errorCode = 5
	AccessDenied errorCode = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func FromGORM

func FromGORM(tx *gorm.DB, msg string) *Error

func JSONParseErr

func JSONParseErr(err error) *Error

func New

func New(code errorCode, cause error, msg string) *Error

func Newf

func Newf(code errorCode, cause error, format string, args ...interface{}) *Error

func (*Error) Cause

func (e *Error) Cause() error

func (*Error) Code

func (e *Error) Code() errorCode

func (*Error) Error

func (e *Error) Error() string

func (*Error) JSON

func (e *Error) JSON(safe bool) []byte

JSON parses error to json format.

If safe is true, cause will not be parsed

Jump to

Keyboard shortcuts

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