1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use bb8_redis::{bb8::RunError, redis::RedisError};
use serde_json::error::Error as SerializeJsonError;
use thiserror::Error as ThisError;
#[derive(ThisError, Debug)]
pub enum RsmqError {
#[error("Redis error: `{0:?}`")]
RedisError(#[from] RedisError),
#[error("Pool run error: `{0:?}`")]
RunError(#[from] RunError<RedisError>),
#[error("No connection acquired`")]
NoConnectionAcquired,
#[error("No attribute was supplied")]
NoAttributeSupplied,
#[error("No `{0:?}` supplied")]
MissingParameter(String),
#[error("Invalid `{0:?} format`")]
InvalidFormat(String),
#[error("{0:?} must be between {0:?} and {0:?}")]
InvalidValue(String, String, String),
#[error("Message not string")]
MessageNotString,
#[error("Message too long")]
MessageTooLong,
#[error("Queue not found")]
QueueNotFound,
#[error("Queue already exists")]
QueueExists,
#[error("Serialize Json Error: `{0:?}`")]
SerializeJsonError(#[from] SerializeJsonError),
}
pub type RsmqResult<T> = Result<T, RsmqError>;