CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 3m46s
CI / Deploy Dashboard (push) Successful in 2m53s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Successful in 2m2s
45 lines
1.0 KiB
Rust
45 lines
1.0 KiB
Rust
use compliance_core::CoreError;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum AgentError {
|
|
#[error(transparent)]
|
|
Core(#[from] CoreError),
|
|
|
|
#[error("Database error: {0}")]
|
|
Database(#[from] mongodb::error::Error),
|
|
|
|
#[error("Git error: {0}")]
|
|
Git(#[from] git2::Error),
|
|
|
|
#[error("HTTP error: {0}")]
|
|
Http(#[from] reqwest::Error),
|
|
|
|
#[error("JSON error: {0}")]
|
|
Json(#[from] serde_json::Error),
|
|
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Scheduler error: {0}")]
|
|
Scheduler(String),
|
|
|
|
#[error("Configuration error: {0}")]
|
|
Config(String),
|
|
|
|
#[error("Dynamic-execution error: {0}")]
|
|
Exec(#[from] werkbank_exec::ExecError),
|
|
|
|
#[error("{0}")]
|
|
Other(String),
|
|
}
|
|
|
|
impl From<AgentError> for axum::http::StatusCode {
|
|
fn from(err: AgentError) -> Self {
|
|
match err {
|
|
AgentError::Core(CoreError::NotFound(_)) => axum::http::StatusCode::NOT_FOUND,
|
|
_ => axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
|
}
|
|
}
|
|
}
|