Help us shape the future of Go! Take the 2026 Go Developer Survey

errors

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultErrorHandler

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

DefaultErrorHandler is a default implementation of ErrorHandler

func ErrorCodeToStatusCode

func ErrorCodeToStatusCode(code types.ErrorCode) int

ErrorCodeToStatusCode maps error codes to HTTP status codes

func ErrorHandlingMiddleware

func ErrorHandlingMiddleware(next http.Handler, errorHandler ErrorHandler) http.Handler

ErrorHandlingMiddleware adds error handling to an HTTP handler

func ExtractOperationFromPath

func ExtractOperationFromPath(path string) string

ExtractOperationFromPath extracts the operation name from a request path e.g., "/api/v1/instances/my-instance/start" -> "StartInstance"

func FromAWSError

func FromAWSError(err error, operation string, resource string) types.APIError

FromAWSError creates an APIError from an AWS error

func FromAuthError

func FromAuthError(err error, detail string) types.APIError

FromAuthError creates an APIError from an authentication error

func FromNetworkError

func FromNetworkError(err error, operation string) types.APIError

FromNetworkError creates an APIError from a network error

func FromPermissionDenied

func FromPermissionDenied(operation string, resource string) types.APIError

FromPermissionDenied creates an APIError for permission denied

func FromRequestError

func FromRequestError(err error, operation string) types.APIError

FromRequestError creates an APIError from a request formatting error

func FromTimeout

func FromTimeout(err error, operation string, resource string) types.APIError

FromTimeout creates an APIError from a timeout error

func FromValidationErrors

func FromValidationErrors(validationErrors map[string]string, message string) types.APIError

FromValidationErrors creates an APIError from validation errors

Types

type ErrorHandler

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

ErrorHandler is a function that can handle errors

Jump to

Keyboard shortcuts

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