errorx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorDefaultBadRequest       = 400
	ErrorDefaultUnanthorized     = 401
	ErrorDefaultForbidden        = 403
	ErrorDefaultNotFound         = 404
	ErrorDefaultMethodNotAllowed = 405
	ErrorInternet                = 500

	ErrorDefault           = 1001
	ErrorAccountOrPassword = 1002
	ErrorNotFound          = 1004
	ErrorImportStaffData   = 1005
	ErrorDataExists        = 1006
)

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(err error) (int, interface{})

func NewBadRequestError

func NewBadRequestError(msg ...string) error

func NewBadRequestWithData

func NewBadRequestWithData(code int, data interface{}) error

func NewDefaultError

func NewDefaultError() error

func NewForbiddenError

func NewForbiddenError(msg ...string) error

func NewInternetError

func NewInternetError(msg ...string) error

func NewLogicError

func NewLogicError(code int) error

func NewNotFoundError

func NewNotFoundError(msg ...string) error

func NewTooManyRequestError

func NewTooManyRequestError(msg ...string) error

func NewUnauthorizedError

func NewUnauthorizedError(msg ...string) error

Types

type CodeError

type CodeError struct {
	HttpCode int
	Code     int         `json:"code"`
	Message  string      `json:"message"`
	Content  interface{} `json:"data,omitempty"`
}

func (*CodeError) Data

func (e *CodeError) Data() *CodeErrorResponse

func (*CodeError) Error

func (e *CodeError) Error() string

type CodeErrorResponse

type CodeErrorResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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