use super::SecretKind;
use crate::types::ChannelId;
#[derive(Debug, thiserror::Error)]
#[error("{source}")]
pub struct ProcessError {
pub channel_id: Option<ChannelId>,
#[source]
pub source: crate::Error,
}
impl ProcessError {
pub fn as_non_ok_status(&self) -> Option<(i32, &str)> {
self.source.as_non_ok_status()
}
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum SecretStoreError {
#[error("secret store backend error")]
Backend(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("secret store: missing {kind:?} entries for channel(s): {channel_ids:?}")]
MissingEntries {
kind: SecretKind,
channel_ids: Vec<u64>,
},
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ChannelStoreError {
#[error("channel already exists for {channel_id}")]
AlreadyExists { channel_id: u64 },
#[error("channel not found for {channel_id}")]
NotFound { channel_id: u64 },
#[error("channel store backend error")]
Backend(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum StateStoreError {
#[error("state store backend error")]
Backend(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ShareStoreError {
#[error("share already exists for channel {channel_id} version {version}")]
AlreadyExists { channel_id: u64, version: u32 },
#[error("share not found for channel {channel_id} version {version}")]
NotFound { channel_id: u64, version: u32 },
#[error("share store backend error")]
Backend(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
}