Skip to content

Commit f1a99ff

Browse files
Merge pull request #99 from renyuneyun/check_category
Use the error message for Category FromParam
2 parents 7a68eb1 + 8e2f882 commit f1a99ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/category.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Category {
2525
}
2626

2727
impl<'r> FromParam<'r> for Category {
28-
type Error = &'r RawStr;
28+
type Error = String;
2929

3030
fn from_param(param: &'r RawStr) -> Result<Self, Self::Error> {
3131
let res = param.url_decode();
@@ -34,10 +34,10 @@ impl<'r> FromParam<'r> for Category {
3434
if is_category(&url) {
3535
Ok(Category { name: url })
3636
} else {
37-
Err(RawStr::from_str("no such category"))
37+
Err(format!("No category called <{}>", url))
3838
}
3939
}
40-
Err(e) => Err(RawStr::from_str("url illegal in utf-8")),
40+
Err(e) => Err(format!("URL illegal in utf-8 ({})", e)),
4141
}
4242
}
4343
}

0 commit comments

Comments
 (0)