util

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseRequestBody     = errors.New("failed to parse request body").WithCode("ERR_PARSE_REQUEST_BODY").WithKind(errors.KindInvalidInput)
	ErrMissingAccountID     = errors.New("missing account id parameter").WithCode("ERR_MISSING_ACCOUNT_ID").WithKind(errors.KindInvalidInput)
	ErrMissingPhaseID       = errors.New("missing phase id parameter").WithCode("ERR_MISSING_PHASE_ID").WithKind(errors.KindInvalidInput)
	ErrMissingJourneyID     = errors.New("missing journey id parameter").WithCode("ERR_MISSING_JOURNEY_ID").WithKind(errors.KindInvalidInput)
	ErrInvalidAccountID     = errors.New("invalid account id parameter").WithCode("ERR_INVALID_ACCOUNT_ID").WithKind(errors.KindInvalidInput)
	ErrMissingCustomerID    = errors.New("missing customer id parameter").WithCode("ERR_MISSING_CUSTOMER_ID").WithKind(errors.KindInvalidInput)
	ErrMissingCorrelationID = errors.New("missing correlation id parameter").WithCode("ERR_MISSING_CORRELATION_ID").WithKind(errors.KindInvalidInput)

	ErrInvalidCountryCode = errors.New("invalid country code parameter").WithCode("ERR_INVALID_COUNTRY_CODE").WithKind(errors.KindInvalidInput)
	ErrInvalidStateCode   = errors.New("invalid state code parameter").WithCode("ERR_INVALID_STATE_CODE").WithKind(errors.KindInvalidInput)
)

Functions

func WriteError

func WriteError(ctx context.Context, rw http.ResponseWriter, err error)

func WriteResponse

func WriteResponse(rw http.ResponseWriter, status int, response any)

Types

type APIError

type APIError struct {
	Code      string         `example:"ERR_SOMETHING_WENT_WRONG" json:"code"`
	Message   string         `example:"Something went wrong"     json:"message"`
	Retryable bool           `example:"true"                     json:"retryable"`
	Details   map[string]any `json:"details,omitempty"`
}

func NewAPIError

func NewAPIError(err error) *APIError

func (*APIError) Error

func (e *APIError) Error() string

Jump to

Keyboard shortcuts

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