summaryrefslogtreecommitdiff
path: root/dhall/src/error
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/error')
-rw-r--r--dhall/src/error/mod.rs12
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)