errors

package
v0.0.0-...-7538a8c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FileNameErrorCodeCollection = "./configs/resources/error-codes.json"
	DefaultErrorCode            = "CORE-999"
)

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(msg string) error

BadRequest will throw if the given request-body or params is not valid

func Code

func Code(errorCode string) error

Error

func CodeMsg

func CodeMsg(errorCode, msg string) error

Error

func Conflict

func Conflict(msg string) error

Conflict will throw if the current action already exists

func Error

func Error(errorString ErrorString) error

func ForbiddenError

func ForbiddenError(msg string) error

func InternalServerError

func InternalServerError(msg string) error

InternalServerError will throw if any the Internal Server Error happen, Database, Third Party etc.

func MethodNotAllowed

func MethodNotAllowed(msg string) error

NotFound will throw if the requested item is not exists

func NotFound

func NotFound(msg string) error

NotFound will throw if the requested item is not exists

func UnauthorizedError

func UnauthorizedError(msg string) error

Types

type ErrorCode

type ErrorCode struct {
	ErrorCode  string `json:"error-code"`
	StatusCode int    `json:"status-code"`
	MsgEn      string `json:"msg-en"`
	MsgId      string `json:"msg-id"`
}

func GetErrorInfo

func GetErrorInfo(errorCode string) ErrorCode

type ErrorString

type ErrorString struct {
	StatusCode   int
	ResponseCode string
	MessageId    string
	MessageEn    string
}

func (ErrorString) Error

func (e ErrorString) Error() string

Jump to

Keyboard shortcuts

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