Files
radicle-ci-broker/src/error.rs
T
Lars Wirzenius 0b862ab0ed refactor: add a ConfigError type for config.rs
It's more tidy if every module has its own error type, to avoid
unnecessary coupling and tangling between modules.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-29 16:37:52 +02:00

38 lines
1.0 KiB
Rust

//! Possible errors returned by the CI broker library.
use std::path::PathBuf;
use crate::{config::ConfigError, msg::MessageError};
/// All possible errors from the CI broker messages.
#[derive(Debug, thiserror::Error)]
pub enum BrokerError {
/// A configuration related error.
#[error(transparent)]
Config(#[from] ConfigError),
/// A message related error.
#[error(transparent)]
Message(#[from] MessageError),
/// Error from an node event subscriber.
#[error(transparent)]
NodeEvent(#[from] crate::event::NodeEventError),
/// Error from Radicle.
#[error(transparent)]
RadicleProfile(#[from] radicle::profile::Error),
/// Error from spawning a sub-process.
#[error("failed to spawn a CI adapter sub-process: {0}")]
SpawnAdapter(PathBuf, #[source] std::io::Error),
/// Usage error.
#[error("usage: radicle-ci-broker CONFIG")]
Usage,
/// Default adapter is not in list of adapters.
#[error("default adapter is not in list of adapters")]
UnknownDefaultAdapter(String),
}