diff options
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 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", } } } |