summaryrefslogtreecommitdiff
path: root/dhall/src/error
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/error')
-rw-r--r--dhall/src/error/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs
index ef4d41f..4b78a60 100644
--- a/dhall/src/error/mod.rs
+++ b/dhall/src/error/mod.rs
@@ -22,6 +22,7 @@ pub enum ErrorKind {
Encode(EncodeError),
Resolve(ImportError),
Typecheck(TypeError),
+ Cache(CacheError),
}
#[derive(Debug)]
@@ -57,6 +58,13 @@ pub enum TypeMessage {
Custom(String),
}
+#[derive(Debug)]
+pub enum CacheError {
+ MissingConfiguration,
+ InitialisationError { cause: IOError },
+ CacheHashInvalid
+}
+
impl Error {
pub fn new(kind: ErrorKind) -> Self {
Error { kind }
@@ -93,6 +101,7 @@ impl std::fmt::Display for Error {
ErrorKind::Encode(err) => write!(f, "{:?}", err),
ErrorKind::Resolve(err) => write!(f, "{:?}", err),
ErrorKind::Typecheck(err) => write!(f, "{}", err),
+ ErrorKind::Cache(err) => write!(f, "{:?}", err),
}
}
}
@@ -138,3 +147,8 @@ impl From<TypeError> for Error {
ErrorKind::Typecheck(err).into()
}
}
+impl From<CacheError> for Error {
+ fn from(err: CacheError) -> Error {
+ ErrorKind::Cache(err).into()
+ }
+}