Documentation
¶
Overview ¶
Package dto owns shared administrative HTTP response values.
Index ¶
Constants ¶
View Source
const ( ErrorTypeInvalidRequest = "invalid_request_error" ErrorTypeAuthenticationError = "authentication_error" ErrorTypePermissionError = "permission_error" ErrorTypeNotFound = "not_found_error" ErrorTypeRateLimit = "rate_limit_error" ErrorTypeServerError = "server_error" )
Common error types for OpenAI compatibility
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, errType, message string)
WriteError writes an error response
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, data any) error
WriteJSON writes a JSON response
func WriteValidationError ¶
func WriteValidationError(w http.ResponseWriter, field, message string)
WriteValidationError writes a validation error response
Types ¶
type ErrorDetail ¶
type ErrorDetail struct {
Message string `json:"message"`
Type string `json:"type"`
Code string `json:"code,omitempty"`
Param *string `json:"param,omitempty"`
}
ErrorDetail contains error details
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorDetail `json:"error"`
}
ErrorResponse represents an API error response
Click to show internal directories.
Click to hide internal directories.