Documentation
¶
Overview ¶
Package errors provides error types for amq
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Queue errors ErrQueueNotFound = errors.New("queue not found") ErrQueueExists = errors.New("queue already exists") ErrQueueFull = errors.New("queue at capacity") ErrQueueEmpty = errors.New("queue is empty") // Client errors ErrClientNotFound = errors.New("client not registered") ErrClientExists = errors.New("client already exists") ErrClientNotActive = errors.New("client not active") // Message errors ErrMessageNotFound = errors.New("message not found") ErrMessageExpired = errors.New("message TTL exceeded") ErrMessageTooLarge = errors.New("message exceeds size limit") ErrInvalidMessage = errors.New("invalid message format") // Subscription errors ErrNotSubscribed = errors.New("client not subscribed to topic") ErrAlreadySubscribed = errors.New("client already subscribed") // System errors ErrBackpressure = errors.New("system under load") ErrCircuitOpen = errors.New("circuit breaker open") ErrShuttingDown = errors.New("system shutting down") ErrTimeout = errors.New("operation timed out") // Storage errors ErrStorageFailure = errors.New("storage operation failed") ErrTransactionFailed = errors.New("transaction failed") )
Common AMQ errors
Functions ¶
func IsRetryable ¶
IsRetryable returns true if the error is retryable
Types ¶
type AMQError ¶
type AMQError struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Component string `json:"component"`
Timestamp time.Time `json:"timestamp"`
Cause error `json:"-"`
Details interface{} `json:"details,omitempty"`
}
AMQError provides structured error information
func NewAMQError ¶
NewAMQError creates a new AMQ error
func (*AMQError) WithDetails ¶
WithDetails adds details to the error
type APIError ¶
type APIError struct {
Code int `json:"code"`
Message string `json:"message"`
StatusCode int `json:"status_code"`
}
APIError represents an API error
func NewAPIError ¶
NewAPIError creates a new API error
type ErrorCode ¶
type ErrorCode int
ErrorCode represents specific error codes
const ( // Queue errors (1000-1999) CodeQueueNotFound ErrorCode = 1001 CodeQueueExists ErrorCode = 1002 CodeQueueFull ErrorCode = 1003 CodeQueueEmpty ErrorCode = 1004 // Client errors (2000-2999) CodeClientNotFound ErrorCode = 2001 CodeClientExists ErrorCode = 2002 CodeClientNotActive ErrorCode = 2003 CodeAuthFailed ErrorCode = 2004 // Message errors (3000-3999) CodeMessageNotFound ErrorCode = 3001 CodeMessageExpired ErrorCode = 3002 CodeMessageTooLarge ErrorCode = 3003 CodeInvalidMessage ErrorCode = 3004 // System errors (4000-4999) CodeBackpressure ErrorCode = 4001 CodeCircuitOpen ErrorCode = 4002 CodeShuttingDown ErrorCode = 4003 CodeTimeout ErrorCode = 4004 CodeRateLimited ErrorCode = 4005 // Storage errors (5000-5999) CodeStorageFailure ErrorCode = 5001 CodeTransactionFailed ErrorCode = 5002 )
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Code ErrorCode `json:"code"`
Timestamp time.Time `json:"timestamp"`
RequestID string `json:"request_id,omitempty"`
Details interface{} `json:"details,omitempty"`
}
ErrorResponse is used for API error responses
func NewErrorResponse ¶
func NewErrorResponse(err error, requestID string) *ErrorResponse
NewErrorResponse creates a new error response
Click to show internal directories.
Click to hide internal directories.