helper_error

package
v0.0.0-...-d222c98 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHttpStatusText

func GetHttpStatusText(httpStatus int) string

Types

type CommonError

type CommonError struct {
	ClientMessage    string           `json:"message"`
	SystemMessage    interface{}      `json:"data"`
	ValidationErrors ValidationErrors `json:"validationErrors,omitempty"`
	ErrorCode        ErrorCode        `json:"code"`
	ErrorMessage     *string          `json:"-"`
	ErrorTrace       *string          `json:"-"`
}

func NewCommonError

func NewCommonError(errCode ErrorCode, err error) *CommonError

func (CommonError) Error

func (err CommonError) Error() string

func (CommonError) GetHttpStatus

func (err CommonError) GetHttpStatus() int

func (*CommonError) SetClientMessage

func (err *CommonError) SetClientMessage(message string)

func (*CommonError) SetSystemMessage

func (err *CommonError) SetSystemMessage(message interface{})

func (*CommonError) SetValidationMessage

func (err *CommonError) SetValidationMessage(message interface{})

func (CommonError) ToHttpError

func (err CommonError) ToHttpError() HttpError

type ErrorCode

type ErrorCode uint
const UNKNOWN_ERROR ErrorCode = 0

type ErrorDictionaries

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

func RegisterErrorDictionaries

func RegisterErrorDictionaries(
	errorCodes map[ErrorCode]*CommonError,
	httpCodes map[ErrorCode]int,
) *ErrorDictionaries

type HttpError

type HttpError struct {
	CommonError
	HttpStatusNumber int    `json:"-"`
	HttpStatusName   string `json:"type"`
}

func (HttpError) Error

func (err HttpError) Error() string

type ValidationErrors

type ValidationErrors map[string]string

Jump to

Keyboard shortcuts

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