diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-11-20 18:36:04 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-11-24 15:29:38 +0100 |
commit | 02939068e351ce5e37f5258c3ecb45480f3d3656 (patch) | |
tree | 00e1e91bf1d911719f0c9eccfd6589eba8b2fa16 /src/parser/iterator.rs | |
parent | e8afcf56c124b228e4328760af6a7741b1bdd658 (diff) |
Add out of bounds check and error propagation for NaiveDate::from_ymd() calls
* Added recursion limit for error_chain
* Added new error for out-of-bounds error
* Added IntoTimeType helper trait
Diffstat (limited to 'src/parser/iterator.rs')
-rw-r--r-- | src/parser/iterator.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/parser/iterator.rs b/src/parser/iterator.rs index a1db5ae..f06edd0 100644 --- a/src/parser/iterator.rs +++ b/src/parser/iterator.rs @@ -1,6 +1,7 @@ use nom::whitespace::sp; use parser::timetype::*; +use timetype::IntoTimeType; use timetype; use iter; use error; @@ -95,22 +96,22 @@ impl Iterator { match self.2 { Some(UntilSpec::Exact(e)) => { - let base = try!(into_ndt(self.0.into())); - let e = try!(into_ndt(e.into())); + let base = try!(into_ndt(self.0.into_timetype()?)); + let e = try!(into_ndt(e.into_timetype()?)); iter::Iter::build(base, recur) .map(|it| UserIterator::UntilIterator(it.until(e))) }, Some(UntilSpec::Times(i)) => { - let base = try!(into_ndt(self.0.into())); + let base = try!(into_ndt(self.0.into_timetype()?)); iter::Iter::build(base, recur) .map(|it| it.times(i)) .map(UserIterator::TimesIter) }, None => { - let base = try!(into_ndt(self.0.into())); + let base = try!(into_ndt(self.0.into_timetype()?)); iter::Iter::build(base, recur) .map(UserIterator::Iterator) }, |