summaryrefslogtreecommitdiff
path: root/dhall/src/error
diff options
context:
space:
mode:
authorfteychene2020-05-12 14:57:16 +0200
committerfteychene2020-05-15 00:52:53 +0200
commite502da276b4aac49d1ac3b8a8896aa2670a442fc (patch)
tree4c0f31158a5566a7a7f5ed9584a97eb4fa046eab /dhall/src/error
parentfcce380d5b4588dc5934bc2e5448d1d981761b50 (diff)
feat: Add cache resolution on resolve
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()
+ }
+}