errno

package
v0.0.0-...-8cdaf41 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2018 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Common errors
	OK                  = &Errno{Code: 0, Message: "OK"}
	StatusNotFound      = &Errno{Code: 10001, Message: "The incorrect API route."}
	InternalServerError = &Errno{Code: 10002, Message: "Internal server error"}
	ErrBind             = &Errno{Code: 10003, Message: "Error occurred while binding the request body to the struct."}

	ErrValidation      = &Errno{Code: 20001, Message: "Validation failed."}
	ErrValidationTopic = &Errno{Code: 20002, Message: "Validation failed topic can not be empty."}
	ErrValidationDelay = &Errno{Code: 20003, Message: "Validation failed delay should be range from 1 to (2^31 - 1)."}
	ErrValidationBody  = &Errno{Code: 20004, Message: "Validation failed body can not be empty."}
)

Functions

func DecodeErr

func DecodeErr(err error) (int, string)

Types

type Err

type Err struct {
	Code    int
	Message string
	Err     error
}

Err represents an error

func New

func New(errno *Errno, err error) *Err

func (*Err) Add

func (err *Err) Add(message string) error

func (*Err) Addf

func (err *Err) Addf(format string, args ...interface{}) error

func (*Err) Error

func (err *Err) Error() string

type Errno

type Errno struct {
	Code    int
	Message string
}

func (Errno) Error

func (err Errno) Error() string

Jump to

Keyboard shortcuts

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