mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <wpfleger@block.xyz> Signed-off-by: Will Pfleger <wpfleger@squareup.com> Signed-off-by: Will Pfleger <wpfleger96@gmail.com> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub16v54tttfqacx9ycvc3k0ut0npj564ahcuajzy6qjvh57ntmsf4uq4806j2 <d32955ad69077062930cc46cfe2df30ca9aaf6f8e76422681265e9e9af704d78@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Will Pfleger <wpfleger96@gmail.com>
51 lines
1.5 KiB
Rust
51 lines
1.5 KiB
Rust
//! Error types for the relay crate.
|
|
|
|
use thiserror::Error;
|
|
|
|
/// Top-level error type for relay operations.
|
|
#[derive(Debug, Error)]
|
|
pub enum RelayError {
|
|
/// A WebSocket transport error occurred.
|
|
#[error("WebSocket error: {0}")]
|
|
WebSocket(String),
|
|
|
|
/// A JSON serialization or deserialization error.
|
|
#[error("JSON parse error: {0}")]
|
|
Json(#[from] serde_json::Error),
|
|
|
|
/// A database operation failed.
|
|
#[error("Database error: {0}")]
|
|
Database(#[from] buzz_db::DbError),
|
|
|
|
/// An authentication error from the auth service.
|
|
#[error("Auth error: {0}")]
|
|
Auth(#[from] buzz_auth::AuthError),
|
|
|
|
/// A pub/sub error from the pubsub service.
|
|
#[error("PubSub error: {0}")]
|
|
PubSub(#[from] buzz_pubsub::PubSubError),
|
|
|
|
/// The relay has reached its maximum number of concurrent connections.
|
|
#[error("Connection limit reached")]
|
|
ConnectionLimitReached,
|
|
|
|
/// The client has exceeded the allowed request rate.
|
|
#[error("Rate limit exceeded")]
|
|
RateLimitExceeded,
|
|
|
|
/// The client attempted an operation that requires authentication.
|
|
#[error("Not authenticated")]
|
|
NotAuthenticated,
|
|
|
|
/// The client sent a message that could not be parsed.
|
|
#[error("Invalid message format: {0}")]
|
|
InvalidMessage(String),
|
|
|
|
/// An unexpected internal error occurred.
|
|
#[error("Internal error: {0}")]
|
|
Internal(String),
|
|
}
|
|
|
|
/// Convenience alias for relay operation results.
|
|
pub type Result<T> = std::result::Result<T, RelayError>;
|