From d02e62233088df15fd43b86aa97e0695b375a46b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 7 Mar 2016 23:48:01 -0800 Subject: WIP --- 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 7c444e0..6180c13 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -53,6 +53,8 @@ pub enum DecodeErrorKind { NilTooLong, /// There was an error with the syntactical structure of the TOML. SyntaxError, + /// A custom error was generated when decoding. + CustomError(String), /// The end of the TOML input was reached too soon EndOfStream, } @@ -195,6 +197,9 @@ impl fmt::Display for DecodeError { EndOfStream => { write!(f, "end of stream") } + CustomError(ref s) => { + write!(f, "custom error: {}", s) + } }); match self.field { Some(ref s) => { @@ -218,6 +223,7 @@ impl error::Error for DecodeError { NilTooLong => "nonzero length string representing nil", SyntaxError => "syntax error", EndOfStream => "end of stream", + CustomError(..) => "custom error", } } } -- cgit v1.2.3