errors

package
v0.0.0-...-05801a8 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderError

func RenderError(w http.ResponseWriter, r *http.Request, err error)

Types

type APIError

type APIError struct {
	RequestID  string `json:"request_id"`
	ErrorCode  string `json:"error_code"`
	Message    string `json:"message,omitempty"`
	StatusCode int    `json:"status_code"`
	// JSON doesnt marshal Error type; store the error text as a string field
	ErrorText string `json:"error"`
}

func InValidRequestError

func InValidRequestError(ctx context.Context, msg string, err error) APIError

func ServiceFault

func ServiceFault(ctx context.Context, msg string, err error) APIError

func TooManyRequestError

func TooManyRequestError(ctx context.Context, msg string, err error) APIError

func UserError

func UserError(ctx context.Context, msg string, err error) APIError

func (APIError) Error

func (e APIError) Error() string

func (APIError) IsServiceError

func (e APIError) IsServiceError() bool

func (APIError) IsUserError

func (e APIError) IsUserError() bool

func (APIError) Render

func (e APIError) Render(_ http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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