Documentation
¶
Index ¶
- Constants
- func BadRequest(c *gin.Context, message string, err error)
- func Conflict(c *gin.Context, message string)
- func ErrUnsupportedProvider(provider string) error
- func Forbidden(c *gin.Context, message string)
- func InternalError(c *gin.Context, message string, err error)
- func InvalidInvite(c *gin.Context, message string)
- func InvalidOperation(c *gin.Context, message string)
- func IsValidUUID(id string) bool
- func NotFound(c *gin.Context, resource string)
- func ParticipantNotFound(c *gin.Context)
- func SessionNotFound(c *gin.Context)
- func TooManyRequests(c *gin.Context, message string)
- func Unauthorized(c *gin.Context, message string)
- func ValidatePathUUID(c *gin.Context, paramName string) (string, bool)
- func ValidateUUID(c *gin.Context, id string, resourceName string) bool
- func ValidationError(c *gin.Context, err error)
- type ErrorInfo
- type ErrorResponse
Constants ¶
const ( CodeForbidden = "forbidden" CodeNotFound = "not_found" CodeValidationError = "validation_error" CodeServerError = "server_error" CodeBadRequest = "bad_request" CodeConflict = "conflict" CodeTooManyRequests = "too_many_requests" CodeInvalidOperation = "invalid_operation" CodeSessionNotFound = "session_not_found" CodeInvalidInvite = "invalid_invite" CodeParticipantNotFound = "participant_not_found" )
standard error codes
const ( CategoryDatabase = "database" CategoryNetwork = "network" CategoryValidation = "validation" CategoryAuth = "auth" CategoryNotFound = "not_found" CategoryTimeout = "timeout" CategoryUnknown = "unknown" )
error categories for classification
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest returns a 400 bad request error
func ErrUnsupportedProvider ¶
ErrUnsupportedProvider returns an error for unsupported provider
func InternalError ¶
InternalError returns a 500 internal server error
func InvalidInvite ¶
InvalidInvite returns a 401 error for invalid invite tokens
func InvalidOperation ¶
InvalidOperation returns a 400 bad request error for invalid operations
func ParticipantNotFound ¶
ParticipantNotFound returns a 404 error for participant not found
func SessionNotFound ¶
SessionNotFound returns a 404 error for session not found
func TooManyRequests ¶
TooManyRequests returns a 429 too many requests error
func Unauthorized ¶
Unauthorized returns a 401 unauthorized error
func ValidatePathUUID ¶
ValidatePathUUID validates a UUID parameter from the request path
func ValidateUUID ¶
ValidateUUID validates a UUID string and returns 404 if invalid
func ValidationError ¶
ValidationError returns a 400 bad request error for validation failures
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"` // error code (e.g., "unauthorized", "not_found")
Message string `json:"message"` // user-friendly message
Details string `json:"details,omitempty"` // optional details (sanitized in production)
RequestID *string `json:"request_id,omitempty"` // echoed from request for correlation
}
ErrorResponse represents a standardized error response