diff --git a/Cargo.toml b/Cargo.toml index 2e2380f..f601e7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,9 +66,6 @@ derive_more = { version = "1.0.0-beta.6", features = [ "from", ] } -# error handling -terrors = "0.3" - # file watcher inotify = "0.10" diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index 5643845..727e1a9 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -46,7 +46,6 @@ secrecy = { workspace = true } # # # error handling derive_more = { workspace = true } -# terrors = { workspace = true } # # # file watcher # inotify = { workspace = true } diff --git a/crates/git/Cargo.toml b/crates/git/Cargo.toml index 201a0ee..35ed0ee 100644 --- a/crates/git/Cargo.toml +++ b/crates/git/Cargo.toml @@ -48,7 +48,6 @@ secrecy = { workspace = true } # error handling derive_more = { workspace = true } -# terrors = { workspace = true } # # file watcher # inotify = { workspace = true } diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 3c5e5d8..b673091 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -47,9 +47,8 @@ bytes = { workspace = true } ulid = { workspace = true } warp = { workspace = true } -# error handling +# boilerplate derive_more = { workspace = true } -terrors = { workspace = true } # file watcher inotify = { workspace = true } diff --git a/crates/server/src/config/load.rs b/crates/server/src/config/load.rs index 6269346..68d0ea5 100644 --- a/crates/server/src/config/load.rs +++ b/crates/server/src/config/load.rs @@ -1,25 +1,23 @@ use git_next_config::{BranchName, RepoConfig}; use git_next_git::RepoDetails; -use terrors::OneOf; use tracing::error; use crate::gitforge::{self, ForgeFileError}; -pub async fn load( - details: &RepoDetails, - forge: &gitforge::Forge, -) -> Result> { +pub async fn load(details: &RepoDetails, forge: &gitforge::Forge) -> Result { let contents = forge .file_contents_get(&details.branch, ".git-next.toml") - .await - .map_err(OneOf::new)?; - let config = RepoConfig::load(&contents).map_err(OneOf::new)?; - let config = validate(config, forge).await.map_err(OneOf::new)?; + .await?; + let config = RepoConfig::load(&contents)?; + let config = validate(config, forge).await?; Ok(config) } -#[derive(Debug)] +#[derive(Debug, derive_more::From, derive_more::Display)] pub enum Error { + File(ForgeFileError), + Config(crate::config::Error), + Toml(toml::de::Error), Forge(gitforge::ForgeBranchError), BranchNotFound(BranchName), }