diff options
author | Alex Crichton <alex@alexcrichton.com> | 2016-03-11 01:32:16 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2016-03-11 01:32:16 -0800 |
commit | 3345fea3198b67153055f5f455ec5f5a2ab4b8af (patch) | |
tree | 4c1f9d1ab423a5d36af6b429c6ba2ce7f8262084 /src/decoder/mod.rs | |
parent | d02e62233088df15fd43b86aa97e0695b375a46b (diff) | |
download | milf-rs-3345fea3198b67153055f5f455ec5f5a2ab4b8af.tar.gz milf-rs-3345fea3198b67153055f5f455ec5f5a2ab4b8af.zip |
Fix an error message test, simlify some serde code
Diffstat (limited to 'src/decoder/mod.rs')
-rw-r--r-- | src/decoder/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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", } } |