Rename ParseError to IdParseError
This commit is contained in:
parent
a676f4c148
commit
c4b1f7ac8d
2 changed files with 7 additions and 7 deletions
|
@ -191,7 +191,7 @@ fn component_to_str<'a>(com: Component<'a>) -> Result<&'a str, DE> {
|
|||
Component::Normal(s) => Some(s),
|
||||
_ => None,
|
||||
}.and_then(|s| s.to_str())
|
||||
.ok_or(DEK::ParseError.into_error())
|
||||
.ok_or(DEK::IdParseError.into_error())
|
||||
}
|
||||
|
||||
impl FromStoreId for DiaryId {
|
||||
|
@ -204,7 +204,7 @@ impl FromStoreId for DiaryId {
|
|||
|
||||
fn next_component<'a>(components: &'a mut Rev<Components>) -> Result<&'a str, DE> {
|
||||
components.next()
|
||||
.ok_or(DEK::ParseError.into_error())
|
||||
.ok_or(DEK::IdParseError.into_error())
|
||||
.and_then(component_to_str)
|
||||
}
|
||||
|
||||
|
@ -222,21 +222,21 @@ impl FromStoreId for DiaryId {
|
|||
|
||||
match (hour, minute) {
|
||||
(Some(h), Some(m)) => Ok((h, m)),
|
||||
_ => return Err(DE::new(DEK::ParseError, None)),
|
||||
_ => return Err(DE::new(DEK::IdParseError, None)),
|
||||
}
|
||||
}));
|
||||
|
||||
let day: Result<u32,_> = next_component(&mut cmps)
|
||||
.and_then(|s| s.parse::<u32>()
|
||||
.map_err_into(DEK::ParseError));
|
||||
.map_err_into(DEK::IdParseError));
|
||||
|
||||
let month: Result<u32,_> = next_component(&mut cmps)
|
||||
.and_then(|s| s.parse::<u32>()
|
||||
.map_err_into(DEK::ParseError));
|
||||
.map_err_into(DEK::IdParseError));
|
||||
|
||||
let year: Result<i32,_> = next_component(&mut cmps)
|
||||
.and_then(|s| s.parse::<i32>()
|
||||
.map_err_into(DEK::ParseError));
|
||||
.map_err_into(DEK::IdParseError));
|
||||
|
||||
let name = next_component(&mut cmps).map(String::from);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ generate_error_module!(
|
|||
EntryNotInDiary => "Entry not in Diary",
|
||||
IOError => "IO Error",
|
||||
ViewError => "Error viewing diary entry",
|
||||
ParseError => "Error while parsing"
|
||||
IdParseError => "Error while parsing ID"
|
||||
);
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue