-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(blueprint-manager): lots of cleanup
- Loading branch information
1 parent
71072ab
commit c44f3cc
Showing
24 changed files
with
432 additions
and
476 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
use std::fmt::{Display, Formatter}; | ||
pub type Result<T> = std::result::Result<T, Error>; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Error { | ||
pub message: String, | ||
} | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum Error { | ||
#[error("No fetchers found for blueprint")] | ||
NoFetchers, | ||
#[error("Multiple fetchers found for blueprint")] | ||
MultipleFetchers, | ||
#[error("No testing fetcher found for blueprint, despite operating in test mode")] | ||
NoTestFetcher, | ||
#[error("Blueprint does not contain a supported fetcher")] | ||
UnsupportedGadget, | ||
|
||
impl Error { | ||
pub fn msg<T: Into<String>>(msg: T) -> Self { | ||
Self { | ||
message: msg.into(), | ||
} | ||
} | ||
} | ||
#[error("Unable to find matching binary")] | ||
NoMatchingBinary, | ||
#[error("Binary hash {expected} mismatched expected hash of {actual}")] | ||
HashMismatch { expected: String, actual: String }, | ||
#[error("Failed to build binary: {0:?}")] | ||
BuildBinary(std::process::Output), | ||
#[error("Failed to fetch git root: {0:?}")] | ||
FetchGitRoot(std::process::Output), | ||
|
||
impl Display for Error { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
std::fmt::Debug::fmt(self, f) | ||
} | ||
} | ||
#[error("Failed to get initial block hash")] | ||
InitialBlock, | ||
#[error("Finality Notification stream died")] | ||
ClientDied, | ||
#[error("{0}")] | ||
Other(String), | ||
|
||
impl std::error::Error for Error {} | ||
#[error(transparent)] | ||
Io(#[from] std::io::Error), | ||
#[error(transparent)] | ||
Utf8(#[from] std::string::FromUtf8Error), | ||
|
||
impl From<std::io::Error> for Error { | ||
fn from(error: std::io::Error) -> Self { | ||
Error { | ||
message: error.to_string(), | ||
} | ||
} | ||
#[error(transparent)] | ||
Request(#[from] reqwest::Error), | ||
#[error(transparent)] | ||
TangleClient(#[from] gadget_clients::tangle::error::Error), | ||
} |
Oops, something went wrong.