From c2b4a2d9b40efbe4f6cb6fd04f6cb90639f4985f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 12 May 2019 18:44:28 +0200 Subject: Implement binary encoding Closes #39 --- dhall/src/error/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'dhall/src/error') diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 3f482f6..125d013 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -14,6 +14,7 @@ pub enum Error { IO(IOError), Parse(ParseError), Decode(DecodeError), + Encode(EncodeError), Resolve(ImportError), Typecheck(TypeError), Deserialize(String), @@ -32,6 +33,11 @@ pub enum DecodeError { WrongFormatError(String), } +#[derive(Debug)] +pub enum EncodeError { + CBORError(serde_cbor::error::Error), +} + /// A structured type error that includes context #[derive(Debug)] pub struct TypeError { @@ -140,6 +146,7 @@ impl std::fmt::Display for Error { Error::IO(err) => write!(f, "{}", err), Error::Parse(err) => write!(f, "{}", err), Error::Decode(err) => write!(f, "{:?}", err), + Error::Encode(err) => write!(f, "{:?}", err), Error::Resolve(err) => write!(f, "{:?}", err), Error::Typecheck(err) => write!(f, "{:?}", err), Error::Deserialize(err) => write!(f, "{}", err), @@ -163,6 +170,11 @@ impl From for Error { Error::Decode(err) } } +impl From for Error { + fn from(err: EncodeError) -> Error { + Error::Encode(err) + } +} impl From for Error { fn from(err: ImportError) -> Error { Error::Resolve(err) -- cgit v1.2.3