aboutsummaryrefslogtreecommitdiffstats
path: root/src/xml/reader.rs
diff options
context:
space:
mode:
authorEdward Barnard2015-12-30 17:21:28 +0100
committerEdward Barnard2015-12-30 17:21:28 +0100
commitbca7a4a2335a10c6fb86702593fb8ebbdd5d6c40 (patch)
tree787fd7b846a83e641c3e2cd2fcc7aad2ca008b81 /src/xml/reader.rs
parent240d0ceeb7fa6d961dcae0cd3fe1682bb3bed891 (diff)
downloadrust-plist-bca7a4a2335a10c6fb86702593fb8ebbdd5d6c40.tar.bz2
Improve error handling
Diffstat (limited to 'src/xml/reader.rs')
-rw-r--r--src/xml/reader.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xml/reader.rs b/src/xml/reader.rs
index 9f57ab4..82d1be5 100644
--- a/src/xml/reader.rs
+++ b/src/xml/reader.rs
@@ -1,4 +1,5 @@
use chrono::{DateTime, UTC};
+use chrono::format::ParseError as ChronoParseError;
use rustc_serialize::base64::FromBase64;
use std::io::Read;
use std::str::FromStr;
@@ -6,6 +7,12 @@ use xml_rs::reader::{EventReader as XmlEventReader, ParserConfig, XmlEvent};
use {Error, Result, PlistEvent};
+impl From<ChronoParseError> for Error {
+ fn from(_: ChronoParseError) -> Error {
+ Error::InvalidData
+ }
+}
+
pub struct EventReader<R: Read> {
xml_reader: XmlEventReader<R>,
queued_event: Option<XmlEvent>,