api_error

package
v0.0.0-...-1fb6433 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(err error, c echo.Context)

error handler for echo to handle

Types

type ApiError

type ApiError struct {
	ApiErrorCode string `json:"api_error_code"`
	StatusCode   int    `json:"status_code"`
	Title        string `json:"title"`
	Detail       string `json:"detail"`
	Severe       bool   `json:"severe"`
	ProgramData  `json:"program_data"`
}

func AuthorizationError

func AuthorizationError(detail string) ApiError

func BindError

func BindError(err error) ApiError

func ContentTypeError

func ContentTypeError() ApiError

func DBEmptyRowError

func DBEmptyRowError(err error) ApiError

func DBError

func DBError(detail string, err error) ApiError

func GeneralError

func GeneralError(detail string, err error) ApiError

***** Error methods *****

func InvalidMethodError

func InvalidMethodError(method string, uri string, err error) ApiError

func LimiterError

func LimiterError(err error) ApiError

func MissingParamError

func MissingParamError(name string) ApiError

func NewApiError

func NewApiError(statusCode int, title string, detail string, severe bool, err error) ApiError

base function call

func ParamError

func ParamError(name string, err error) ApiError

func ParseError

func ParseError(detail string) ApiError

func RouteNotFoundError

func RouteNotFoundError(detail string, err error) ApiError

func StringLengthError

func StringLengthError(field string, colLen int) ApiError

func (ApiError) BodyError

func (e ApiError) BodyError() BodyError

func (ApiError) Error

func (e ApiError) Error() string

type BodyError

type BodyError struct {
	StatusCode int    `json:"status_code"`
	Title      string `json:"title"`
	Detail     string `json:"detail"`
}

type ProgramData

type ProgramData struct {
	InternalError string `json:"internal_error"`
	FileName      string `json:"file_name"`
	FuncName      string `json:"func_name"`
	LineNumber    int    `json:"line_number"`
}

func SetCaller

func SetCaller(err error, stackLevel int) ProgramData

type RequestData

type RequestData struct {
	User      string `json:"user"`
	IPAddr    string `json:"ip_addr"`
	UserAgent string `json:"user_agent"`
	Method    string `json:"method"`
	URI       string `json:"uri"`
	Body      string `json:"body"`
}

Jump to

Keyboard shortcuts

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