Documentation
¶
Index ¶
- func DefaultErrorHandler(err error, w http.ResponseWriter, r *http.Request)
- func ErrorCodeToStatusCode(code types.ErrorCode) int
- func ErrorHandlingMiddleware(next http.Handler, errorHandler ErrorHandler) http.Handler
- func ExtractOperationFromPath(path string) string
- func FromAWSError(err error, operation string, resource string) types.APIError
- func FromAuthError(err error, detail string) types.APIError
- func FromNetworkError(err error, operation string) types.APIError
- func FromPermissionDenied(operation string, resource string) types.APIError
- func FromRequestError(err error, operation string) types.APIError
- func FromTimeout(err error, operation string, resource string) types.APIError
- func FromValidationErrors(validationErrors map[string]string, message string) types.APIError
- type ErrorHandler
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 ¶
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 ¶
ExtractOperationFromPath extracts the operation name from a request path e.g., "/api/v1/instances/my-instance/start" -> "StartInstance"
func FromAWSError ¶
FromAWSError creates an APIError from an AWS error
func FromAuthError ¶
FromAuthError creates an APIError from an authentication error
func FromNetworkError ¶
FromNetworkError creates an APIError from a network error
func FromPermissionDenied ¶
FromPermissionDenied creates an APIError for permission denied
func FromRequestError ¶
FromRequestError creates an APIError from a request formatting error
func FromTimeout ¶
FromTimeout creates an APIError from a timeout error
Types ¶
type ErrorHandler ¶
type ErrorHandler func(err error, w http.ResponseWriter, r *http.Request)
ErrorHandler is a function that can handle errors