diff options
author | Nadrieril | 2019-05-12 18:44:28 +0200 |
---|---|---|
committer | Nadrieril | 2019-05-12 18:44:44 +0200 |
commit | c2b4a2d9b40efbe4f6cb6fd04f6cb90639f4985f (patch) | |
tree | 02e0f7b57b56f949240cedbdfabac234d9486834 /dhall/src/error | |
parent | 2d1a333d6c1e8571ca91d29333c284104153b0ef (diff) |
Implement binary encoding
Closes #39
Diffstat (limited to 'dhall/src/error')
-rw-r--r-- | dhall/src/error/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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<DecodeError> for Error { Error::Decode(err) } } +impl From<EncodeError> for Error { + fn from(err: EncodeError) -> Error { + Error::Encode(err) + } +} impl From<ImportError> for Error { fn from(err: ImportError) -> Error { Error::Resolve(err) |