api

package
v2.4.39 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSiteMissing         = Error{ErrorCode: "SITE_MISSING", ErrorDescription: "missing site", HttpStatusCode: http.StatusBadRequest}
	ErrUnknown             = Error{ErrorCode: "UNKNOWN_ERROR", ErrorDescription: "error is unknown", HttpStatusCode: http.StatusInternalServerError}
	ErrTimeout             = Error{ErrorCode: "TIMEOUT", ErrorDescription: "request timeout", HttpStatusCode: 499}
	ErrInternalServerError = Error{ErrorCode: "INTERNAL_SERVER_ERROR", ErrorDescription: "internal server error", HttpStatusCode: http.StatusInternalServerError}
	ErrBadRequest          = Error{ErrorCode: "BAD_REQUEST", ErrorDescription: "bad request", HttpStatusCode: http.StatusBadRequest}
)

Functions

This section is empty.

Types

type Error

type Error struct {
	ErrorCode        string                  `json:"errorCode"`
	ErrorDescription string                  `json:"errorDescription"`
	Field            *string                 `json:"field,omitempty"`
	Info             *map[string]interface{} `json:"info,omitempty"`
	HttpStatusCode   int                     `json:"-"`
	BaseError        error                   `json:"-"`
}

func Errorf added in v2.3.27

func Errorf(code string, format string, args ...any) Error

func (Error) Error

func (e Error) Error() string

func (Error) ToErrorResponse

func (e Error) ToErrorResponse() ErrorResponse

func (Error) Unwrap added in v2.3.58

func (e Error) Unwrap() error

func (Error) WithBaseError added in v2.3.58

func (e Error) WithBaseError(err error) Error

func (Error) WithDescription added in v2.3.21

func (e Error) WithDescription(format string, args ...any) Error

type ErrorResponse

type ErrorResponse struct {
	MainError Error   `json:"mainError"`
	AllErrors []Error `json:"allErrors"`
}

func NewErrorResponse

func NewErrorResponse(errorCode string, errorDescription string, field string, info map[string]interface{}) ErrorResponse

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type SiteId

type SiteId string

func GetSiteFromHeader

func GetSiteFromHeader(header http.Header) (SiteId, error)

func (SiteId) ToLower

func (s SiteId) ToLower() SiteId

func (SiteId) ToUpper

func (s SiteId) ToUpper() SiteId

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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