Skip to content

Commit

Permalink
Merge pull request #165 from fteychene/feat/resolve_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril authored May 17, 2020
2 parents fcce380 + 6c26ae4 commit aaba9f7
Show file tree
Hide file tree
Showing 9 changed files with 739 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "dhall-lang"]
path = dhall-lang
url = https://github.com/dhall-lang/dhall-lang
ignore = dirty
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dhall/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ url = "2.1"
[dev-dependencies]
pretty_assertions = "0.6.1"
version-sync = "0.8"
rand = "0.7"

[build-dependencies]
walkdir = "2"
Expand Down
2 changes: 0 additions & 2 deletions dhall/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ fn generate_tests() -> std::io::Result<()> {
variant: "ImportSuccess",
exclude_path: Rc::new(|path: &str| {
false
// TODO: import hash
|| path == "hashFromCache"
// TODO: the standard does not respect https://tools.ietf.org/html/rfc3986#section-5.2
|| path == "unit/asLocation/RemoteCanonicalize4"
// TODO: import headers
Expand Down
14 changes: 14 additions & 0 deletions dhall/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum ErrorKind {
Encode(EncodeError),
Resolve(ImportError),
Typecheck(TypeError),
Cache(CacheError),
}

#[derive(Debug)]
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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),
}
}
}
Expand Down Expand Up @@ -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()
}
}
Loading

0 comments on commit aaba9f7

Please sign in to comment.