greentic_session/
error.rs

1use greentic_types::GResult;
2
3pub use greentic_types::{ErrorCode, GreenticError};
4pub type SessionResult<T> = GResult<T>;
5
6pub(crate) fn serde_error(err: serde_json::Error) -> GreenticError {
7    GreenticError::new(ErrorCode::Internal, err.to_string())
8}
9
10#[cfg(feature = "redis")]
11pub(crate) fn redis_error(err: redis::RedisError) -> GreenticError {
12    GreenticError::new(ErrorCode::Unavailable, err.to_string())
13}