Documentation
¶
Index ¶
- func DecodeJSONBody(r *http.Request, dst any, allowEmpty bool) error
- func RecordRequestError(w http.ResponseWriter, code string, cause error)
- func WriteError(w http.ResponseWriter, _ *http.Request, e *APIError)
- func WriteInternalError(w http.ResponseWriter, r *http.Request, err error)
- func WriteJSON(w http.ResponseWriter, status int, body any)
- type APIError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSONBody ¶
DecodeJSONBody decodes a single JSON object from the request body.
func RecordRequestError ¶
func RecordRequestError(w http.ResponseWriter, code string, cause error)
RecordRequestError records the API error on a compatible response writer.
func WriteError ¶
func WriteError(w http.ResponseWriter, _ *http.Request, e *APIError)
WriteError writes a structured API error response.
func WriteInternalError ¶
func WriteInternalError(w http.ResponseWriter, r *http.Request, err error)
WriteInternalError writes a generic internal error response.
Types ¶
type APIError ¶
type APIError struct {
Status int
Code string
Message string
Cause error
Fields []gatewayapi.FieldError
LockedWorkflows []gatewayapi.WorkflowLockConflict
CurrentWorkflowLock *gatewayapi.WorkflowLock
}
APIError describes an HTTP API error response.
func NewError ¶
func NewError(status int, code string, message string, cause error, fields ...gatewayapi.FieldError) *APIError
NewError returns a new APIError.