From 00f94290a6321888504de272fdf278a51fe0e004 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 28 Jun 2016 22:36:29 -0700 Subject: [PATCH] Add message to CustomError --- serde_test/src/error.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/serde_test/src/error.rs b/serde_test/src/error.rs index 580a5194..cc429f97 100644 --- a/serde_test/src/error.rs +++ b/serde_test/src/error.rs @@ -6,7 +6,7 @@ use token::Token; #[derive(Clone, PartialEq, Debug)] pub enum Error { - SyntaxError, + CustomError(String), EndOfStreamError, UnknownFieldError(String), UnknownVariantError(String), @@ -19,8 +19,8 @@ pub enum Error { } impl ser::Error for Error { - fn custom>(_: T) -> Error { - Error::SyntaxError + fn custom>(msg: T) -> Error { + Error::CustomError(msg.into()) } fn invalid_value(msg: &str) -> Error { @@ -29,8 +29,8 @@ impl ser::Error for Error { } impl de::Error for Error { - fn custom>(_: T) -> Error { - Error::SyntaxError + fn custom>(msg: T) -> Error { + Error::CustomError(msg.into()) } fn end_of_stream() -> Error {