1#[derive(Debug, thiserror::Error)]
5pub enum SkillsError {
6 #[error("{0}")]
8 Message(String),
9 #[error("invalid agents: {0}")]
11 InvalidAgents(String),
12 #[error(transparent)]
14 Io(#[from] std::io::Error),
15 #[error(transparent)]
17 Json(#[from] serde_json::Error),
18 #[error(transparent)]
20 Yaml(#[from] serde_yaml::Error),
21 #[error(transparent)]
23 Git(#[from] git2::Error),
24 #[error(transparent)]
26 Http(Box<ureq::Error>),
27 #[error(transparent)]
29 Zip(#[from] zip::result::ZipError),
30}
31
32pub type Result<T> = std::result::Result<T, SkillsError>;
34
35pub type Error = SkillsError;
37
38impl SkillsError {
39 pub fn msg(msg: impl Into<String>) -> Self {
41 SkillsError::Message(msg.into())
42 }
43}
44
45impl From<ureq::Error> for SkillsError {
46 fn from(e: ureq::Error) -> Self {
47 SkillsError::Http(Box::new(e))
48 }
49}