rerrors

package
v0.0.0-...-6c79d6b Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidRequestErr   = 101
	InternalErr         = 102
	DatabaseErr         = 103
	InvalidAuthErr      = 104
	CustomerNotFoundErr = 105
	SessionNotFoundErr  = 106
	EmailExistsError    = 107
)

Variables

This section is empty.

Functions

func Format

func Format(code int, err error) error

Format Returns a formatted error type

func LogFormat

func LogFormat(code int, err error) error

LogFormat Returns a formatted error type and logs it on the standard output

Types

type Err

type Err struct {
	Code      int
	ErrorType string
	Message   string
	Detail    string
}

Internal error type

func Form

func Form(code int, err error) *Err

Form Returns a formatted error type

func NewErrFromJSON

func NewErrFromJSON(errString string) (*Err, error)

func NewError

func NewError(code int, errorType, message, detail string) *Err

NewError returns a new customized error type

func (*Err) Error

func (e *Err) Error() string

Error returns a json string representation of our customized error type this is the only method required to implement the error interface

Jump to

Keyboard shortcuts

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