Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ vergen = "9.0.6"
vergen-git2 = "1.0.7"
clap = { version = "4.5.53", features = ["derive", "env", "string"] }

# Metrics
metrics-exporter-prometheus = { version = "0.18.1", default-features = false }

# misc
url = "2.5.7"
lru = "0.16.2"
Expand Down
2 changes: 2 additions & 0 deletions crates/shared/cli-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ tokio = { workspace = true, features = ["full"] }
eyre.workspace = true
clap = { workspace = true, features = ["derive"] }
tracing.workspace = true
thiserror.workspace = true
metrics-exporter-prometheus = { workspace = true, features = ["http-listener"] }

[target.'cfg(unix)'.dependencies]
libc = "0.2"
26 changes: 26 additions & 0 deletions crates/shared/cli-utils/src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! Error types for CLI utilities.

use thiserror::Error;

/// Errors that can occur in CLI operations.
#[derive(Error, Debug)]
pub enum CliError {
/// Error when no chain config is found for the given chain ID.
#[error("No chain config found for chain ID: {0}")]
ChainConfigNotFound(u64),

/// Error when no roles are found for the given chain ID.
#[error("No roles found for chain ID: {0}")]
RolesNotFound(u64),

/// Error when no unsafe block signer is found for the given chain ID.
#[error("No unsafe block signer found for chain ID: {0}")]
UnsafeBlockSignerNotFound(u64),

/// Error initializing metrics.
#[error("Failed to initialize metrics")]
MetricsInitialization(#[from] metrics_exporter_prometheus::BuildError),
}

/// Type alias for CLI results.
pub type CliResult<T> = Result<T, CliError>;
3 changes: 3 additions & 0 deletions crates/shared/cli-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub use sigsegv::SigsegvHandler;
mod backtrace;
pub use backtrace::Backtracing;

mod errors;
pub use errors::{CliError, CliResult};

mod args;
pub use args::GlobalArgs;

Expand Down
Loading