mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 09:49:07 +01:00
Merge pull request #37 from teloxide/enhance-path-error-msg
Enhance an error message about a path
This commit is contained in:
commit
e715105dda
1 changed files with 10 additions and 7 deletions
|
@ -12,7 +12,9 @@ pub(crate) enum ParserType {
|
|||
|
||||
impl ParserType {
|
||||
pub fn parse(value: AttrValue) -> Result<Self> {
|
||||
value.expect(r#""default", "split" or a path"#, |v| match v {
|
||||
value.expect(
|
||||
r#""default", "split", or a path to a custom parser function"#,
|
||||
|v| match v {
|
||||
AttrValue::Path(p) => Ok(ParserType::Custom(p)),
|
||||
AttrValue::Lit(syn::Lit::Str(ref l)) => match &*l.value() {
|
||||
"default" => Ok(ParserType::Default),
|
||||
|
@ -20,7 +22,8 @@ impl ParserType {
|
|||
_ => Err(v),
|
||||
},
|
||||
_ => Err(v),
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue