mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-11-29 06:40:31 +08:00
Instead of only a single JSON file, updated every so often, also generate HTML pages that show CI broker status, and lists every repository for which the broker has run CI. This currently assumes the native CI adapter, but that can be fixed to be more generic later. Signed-off-by: Lars Wirzenius <liw@liw.fi>
70 lines
2.0 KiB
Rust
70 lines
2.0 KiB
Rust
//! Possible errors returned by the CI broker library.
|
|
//!
|
|
//! Each module has its own error type, this module collects them
|
|
//! together into a unified type, for callers who don't care to handle
|
|
//! module errors in specific ways.
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use radicle::prelude::RepoId;
|
|
|
|
use crate::{
|
|
adapter::AdapterError,
|
|
config::ConfigError,
|
|
msg::{MessageError, Request},
|
|
pages::PageError,
|
|
};
|
|
|
|
/// All possible errors from the CI broker messages.
|
|
#[derive(Debug, thiserror::Error)]
|
|
#[allow(clippy::large_enum_variant)]
|
|
pub enum BrokerError {
|
|
/// A configuration related error.
|
|
#[error(transparent)]
|
|
Config(#[from] ConfigError),
|
|
|
|
/// A message related error.
|
|
#[error(transparent)]
|
|
Message(#[from] MessageError),
|
|
|
|
/// An adapter related error.
|
|
#[error(transparent)]
|
|
Adapter(#[from] AdapterError),
|
|
|
|
/// 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),
|
|
|
|
/// No adapter set for repository and no default adapter set.
|
|
#[error("could not determine what adapter to use for repository {0}")]
|
|
NoAdapter(RepoId),
|
|
|
|
/// Request is not a trigger message.
|
|
#[error("tried to execute CI based on a message that is not a trigger one: {0:#?}")]
|
|
NotTrigger(Request),
|
|
|
|
/// Could not convert repository ID from string.
|
|
#[error("failed to understand repository id {0:?}")]
|
|
BadRepoId(String, #[source] radicle::identity::IdError),
|
|
|
|
/// Status page error.
|
|
#[error(transparent)]
|
|
StatusPage(#[from] PageError),
|
|
}
|