summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/resolve
diff options
context:
space:
mode:
authorNadrieril2020-11-01 18:59:01 +0000
committerNadrieril2020-11-01 19:01:04 +0000
commit8cfb6d563d26abb2fa80124eda2231eb05c7f3e6 (patch)
tree5f5f987bb55faa903bacf692f19f524bd1aee38e /dhall/src/semantics/resolve
parent2ae979a22ee4b79590f74110d61164383c7b5182 (diff)
feat: add location to import error messages
This is crude but helpful. See #40
Diffstat (limited to 'dhall/src/semantics/resolve')
-rw-r--r--dhall/src/semantics/resolve/resolve.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs
index 614ea22..68b899c 100644
--- a/dhall/src/semantics/resolve/resolve.rs
+++ b/dhall/src/semantics/resolve/resolve.rs
@@ -411,9 +411,17 @@ fn resolve_with_env(
// Resolve this import, making sure that recursive imports don't cycle back to the
// current one.
- let typed = env.with_cycle_detection(location.clone(), |env| {
+ let res = env.with_cycle_detection(location.clone(), |env| {
resolve_one_import(env, &import, location.clone(), span.clone())
- })?;
+ });
+ let typed = match res {
+ Ok(typed) => typed,
+ Err(e) => mkerr(
+ ErrorBuilder::new("error")
+ .span_err(span.clone(), e.to_string())
+ .format(),
+ )?,
+ };
// Add the resolved import to the caches
check_hash(&import, &typed, span)?;