Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: simplify error for SortBy's FromStr
Fintan Halpenny committed 6 months ago
commit 076b32aca595b690dde828cc3a5686f42839c63a
parent c3f320dd9d73b32d2898f0cfaf0168e8a5bd959b
1 file changed +2 -8
modified crates/radicle-cli/src/commands/inbox/args.rs
@@ -120,19 +120,13 @@ impl Display for SortBy {
}

impl FromStr for SortBy {
-
    type Err = error::ParseSortBy;
+
    type Err = String;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "id" => Ok(Self::Id),
            "timestamp" => Ok(Self::Timestamp),
-
            _ => Err(error::ParseSortBy(s.to_owned())),
+
            _ => Err(format!("'{s}' is not a valid sort by column")),
        }
    }
}
-

-
mod error {
-
    #[derive(Debug, thiserror::Error)]
-
    #[error("'{0}' is not a valid sort by column")]
-
    pub struct ParseSortBy(pub(super) String);
-
}