From 78acb5081d57bec85fd51ecb596506b14d17d430 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 4 Nov 2014 11:56:11 -0800 Subject: Implement the libstd error trait for errors --- src/parser.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/parser.rs') 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 { Some(self.desc.clone()) } +} + #[cfg(test)] mod tests { use {Table, Parser}; -- cgit v1.2.3