From e502da276b4aac49d1ac3b8a8896aa2670a442fc Mon Sep 17 00:00:00 2001 From: fteychene Date: Tue, 12 May 2020 14:57:16 +0200 Subject: feat: Add cache resolution on resolve --- dhall/src/error/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'dhall/src/error/mod.rs') 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 for Error { ErrorKind::Typecheck(err).into() } } +impl From for Error { + fn from(err: CacheError) -> Error { + ErrorKind::Cache(err).into() + } +} -- cgit v1.2.3