Add message to CustomError
This commit is contained in:
parent
093201abfb
commit
00f94290a6
@ -6,7 +6,7 @@ use token::Token;
|
|||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
SyntaxError,
|
CustomError(String),
|
||||||
EndOfStreamError,
|
EndOfStreamError,
|
||||||
UnknownFieldError(String),
|
UnknownFieldError(String),
|
||||||
UnknownVariantError(String),
|
UnknownVariantError(String),
|
||||||
@ -19,8 +19,8 @@ pub enum Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ser::Error for Error {
|
impl ser::Error for Error {
|
||||||
fn custom<T: Into<String>>(_: T) -> Error {
|
fn custom<T: Into<String>>(msg: T) -> Error {
|
||||||
Error::SyntaxError
|
Error::CustomError(msg.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invalid_value(msg: &str) -> Error {
|
fn invalid_value(msg: &str) -> Error {
|
||||||
@ -29,8 +29,8 @@ impl ser::Error for Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl de::Error for Error {
|
impl de::Error for Error {
|
||||||
fn custom<T: Into<String>>(_: T) -> Error {
|
fn custom<T: Into<String>>(msg: T) -> Error {
|
||||||
Error::SyntaxError
|
Error::CustomError(msg.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn end_of_stream() -> Error {
|
fn end_of_stream() -> Error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user