From 3345fea3198b67153055f5f455ec5f5a2ab4b8af Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 11 Mar 2016 01:32:16 -0800 Subject: Fix an error message test, simlify some serde code --- src/decoder/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/decoder/mod.rs') diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 6180c13..a596280 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -57,6 +57,8 @@ pub enum DecodeErrorKind { CustomError(String), /// The end of the TOML input was reached too soon EndOfStream, + /// Produced by serde ... + InvalidType(&'static str), } /// Decodes a TOML value into a decodable type. @@ -197,6 +199,9 @@ impl fmt::Display for DecodeError { EndOfStream => { write!(f, "end of stream") } + InvalidType(s) => { + write!(f, "invalid type: {}", s) + } CustomError(ref s) => { write!(f, "custom error: {}", s) } @@ -223,6 +228,7 @@ impl error::Error for DecodeError { NilTooLong => "nonzero length string representing nil", SyntaxError => "syntax error", EndOfStream => "end of stream", + InvalidType(..) => "invalid type", CustomError(..) => "custom error", } } -- cgit v1.2.3