diff options
Diffstat (limited to 'src/decoder/serde.rs')
-rw-r--r-- | src/decoder/serde.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/decoder/serde.rs b/src/decoder/serde.rs index 6f60892..326f7ee 100644 --- a/src/decoder/serde.rs +++ b/src/decoder/serde.rs @@ -15,7 +15,13 @@ fn se2toml(err: de::value::Error, ty: &'static str) -> DecodeError { field: Some(s.to_string()), kind: DecodeErrorKind::ExpectedField(Some(ty)), } - } + }, + de::value::Error::UnknownFieldError(s) => { + DecodeError { + field: Some(s.to_string()), + kind: DecodeErrorKind::UnknownField, + } + }, } } @@ -91,6 +97,12 @@ impl de::Error for DecodeError { kind: DecodeErrorKind::ExpectedField(None), } } + fn unknown_field_error(name: &str) -> DecodeError { + DecodeError { + field: Some(name.to_string()), + kind: DecodeErrorKind::UnknownField, + } + } } impl de::Deserializer for SubDecoder { |