Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RespondError ¶
RespondError writes a JSON error response with the given HTTP status code. The code parameter is a machine-readable slug (e.g. "not_found"), while message is a human-readable description of the problem.
func RespondErrorWithDetails ¶
RespondErrorWithDetails writes a JSON error response that includes structured details, useful for validation errors where callers benefit from knowing exactly which fields failed.
Types ¶
type APIError ¶
type APIError struct {
Error string `json:"error"`
Message string `json:"message"`
Details any `json:"details,omitempty"`
}
APIError is the standard JSON error response body returned by all API endpoints. It provides a machine-readable error code and a human-readable message, with an optional details field for structured validation errors.
Click to show internal directories.
Click to hide internal directories.