errors

package
v0.0.0-...-74bcc06 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeUnauthorized        = "unauthorized"
	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

View Source
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

func BadRequest(c *gin.Context, message string, err error)

BadRequest returns a 400 bad request error

func Conflict

func Conflict(c *gin.Context, message string)

Conflict returns a 409 conflict error

func ErrUnsupportedProvider

func ErrUnsupportedProvider(provider string) error

ErrUnsupportedProvider returns an error for unsupported provider

func Forbidden

func Forbidden(c *gin.Context, message string)

Forbidden returns a 403 forbidden error

func InternalError

func InternalError(c *gin.Context, message string, err error)

InternalError returns a 500 internal server error

func InvalidInvite

func InvalidInvite(c *gin.Context, message string)

InvalidInvite returns a 401 error for invalid invite tokens

func InvalidOperation

func InvalidOperation(c *gin.Context, message string)

InvalidOperation returns a 400 bad request error for invalid operations

func IsValidUUID

func IsValidUUID(id string) bool

IsValidUUID validates a UUID string format

func NotFound

func NotFound(c *gin.Context, resource string)

NotFound returns a 404 not found error

func ParticipantNotFound

func ParticipantNotFound(c *gin.Context)

ParticipantNotFound returns a 404 error for participant not found

func SessionNotFound

func SessionNotFound(c *gin.Context)

SessionNotFound returns a 404 error for session not found

func TooManyRequests

func TooManyRequests(c *gin.Context, message string)

TooManyRequests returns a 429 too many requests error

func Unauthorized

func Unauthorized(c *gin.Context, message string)

Unauthorized returns a 401 unauthorized error

func ValidatePathUUID

func ValidatePathUUID(c *gin.Context, paramName string) (string, bool)

ValidatePathUUID validates a UUID parameter from the request path

func ValidateUUID

func ValidateUUID(c *gin.Context, id string, resourceName string) bool

ValidateUUID validates a UUID string and returns 404 if invalid

func ValidationError

func ValidationError(c *gin.Context, err error)

ValidationError returns a 400 bad request error for validation failures

Types

type ErrorInfo

type ErrorInfo struct {
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL