chore (backend-rs): use proper error type
This commit is contained in:
parent
bc7fdc5c0b
commit
b752695057
1 changed files with 6 additions and 3 deletions
|
@ -7,10 +7,13 @@ pub struct Acct {
|
|||
pub host: Option<String>,
|
||||
}
|
||||
|
||||
impl FromStr for Acct {
|
||||
type Err = ();
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[error("failed to convert string '{0}' into acct")]
|
||||
pub struct InvalidAcctString(String);
|
||||
|
||||
impl FromStr for Acct {
|
||||
type Err = InvalidAcctString;
|
||||
|
||||
/// This never throw errors. Feel free to `.unwrap()` the result.
|
||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
||||
let split: Vec<&str> = if let Some(stripped) = value.strip_prefix('@') {
|
||||
stripped
|
||||
|
|
Loading…
Reference in a new issue