chore: remove dependency on terrors
All checks were successful
Rust / build (push) Successful in 1m15s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful

This commit is contained in:
Paul Campbell 2024-05-18 22:16:17 +01:00
parent 85d38ede56
commit f56ac321f4
5 changed files with 9 additions and 17 deletions

View file

@ -66,9 +66,6 @@ derive_more = { version = "1.0.0-beta.6", features = [
"from", "from",
] } ] }
# error handling
terrors = "0.3"
# file watcher # file watcher
inotify = "0.10" inotify = "0.10"

View file

@ -46,7 +46,6 @@ secrecy = { workspace = true }
# #
# # error handling # # error handling
derive_more = { workspace = true } derive_more = { workspace = true }
# terrors = { workspace = true }
# #
# # file watcher # # file watcher
# inotify = { workspace = true } # inotify = { workspace = true }

View file

@ -48,7 +48,6 @@ secrecy = { workspace = true }
# error handling # error handling
derive_more = { workspace = true } derive_more = { workspace = true }
# terrors = { workspace = true }
# # file watcher # # file watcher
# inotify = { workspace = true } # inotify = { workspace = true }

View file

@ -47,9 +47,8 @@ bytes = { workspace = true }
ulid = { workspace = true } ulid = { workspace = true }
warp = { workspace = true } warp = { workspace = true }
# error handling # boilerplate
derive_more = { workspace = true } derive_more = { workspace = true }
terrors = { workspace = true }
# file watcher # file watcher
inotify = { workspace = true } inotify = { workspace = true }

View file

@ -1,25 +1,23 @@
use git_next_config::{BranchName, RepoConfig}; use git_next_config::{BranchName, RepoConfig};
use git_next_git::RepoDetails; use git_next_git::RepoDetails;
use terrors::OneOf;
use tracing::error; use tracing::error;
use crate::gitforge::{self, ForgeFileError}; use crate::gitforge::{self, ForgeFileError};
pub async fn load( pub async fn load(details: &RepoDetails, forge: &gitforge::Forge) -> Result<RepoConfig, Error> {
details: &RepoDetails,
forge: &gitforge::Forge,
) -> Result<RepoConfig, OneOf<(ForgeFileError, crate::config::Error, toml::de::Error, Error)>> {
let contents = forge let contents = forge
.file_contents_get(&details.branch, ".git-next.toml") .file_contents_get(&details.branch, ".git-next.toml")
.await .await?;
.map_err(OneOf::new)?; let config = RepoConfig::load(&contents)?;
let config = RepoConfig::load(&contents).map_err(OneOf::new)?; let config = validate(config, forge).await?;
let config = validate(config, forge).await.map_err(OneOf::new)?;
Ok(config) Ok(config)
} }
#[derive(Debug)] #[derive(Debug, derive_more::From, derive_more::Display)]
pub enum Error { pub enum Error {
File(ForgeFileError),
Config(crate::config::Error),
Toml(toml::de::Error),
Forge(gitforge::ForgeBranchError), Forge(gitforge::ForgeBranchError),
BranchNotFound(BranchName), BranchNotFound(BranchName),
} }