diff options
author | Alex Crichton <alex@alexcrichton.com> | 2014-11-04 11:56:11 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2014-11-04 11:56:11 -0800 |
commit | 78acb5081d57bec85fd51ecb596506b14d17d430 (patch) | |
tree | 159fdd2e4e92060b53895218bdca8fb59b70f9fa /src/parser.rs | |
parent | 902b3c6f8f6a5b23f7f6824a12d951527cb11d86 (diff) | |
download | milf-rs-78acb5081d57bec85fd51ecb596506b14d17d430.tar.gz milf-rs-78acb5081d57bec85fd51ecb596506b14d17d430.zip |
Implement the libstd error trait for errors
Diffstat (limited to 'src/parser.rs')
-rw-r--r-- | src/parser.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs index ce3571e..e1d784d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,5 +1,6 @@ use std::char; use std::collections::{TreeMap, HashSet}; +use std::error::Error; use std::num::FromStrRadix; use std::str; @@ -760,6 +761,11 @@ impl<'a> Parser<'a> { } } +impl Error for ParserError { + fn description(&self) -> &str { "TOML parse error" } + fn detail(&self) -> Option<String> { Some(self.desc.clone()) } +} + #[cfg(test)] mod tests { use {Table, Parser}; |