From 7fb19d5ef8dc3b183d7de811e373768de56f7ee8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 14 Jun 2022 20:07:27 +0200 Subject: Unified file loading errors --- src/eval/mod.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/eval') diff --git a/src/eval/mod.rs b/src/eval/mod.rs index b1cf9e0b..e2090cd2 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -967,12 +967,7 @@ impl Eval for IncludeExpr { fn import(vm: &mut Machine, path: &str, span: Span) -> TypResult { // Load the source file. let full = vm.locate(&path).at(span)?; - let id = vm.ctx.sources.load(&full).map_err(|err| match err.kind() { - std::io::ErrorKind::NotFound => { - error!(span, "file not found (searched at {})", full.display()) - } - _ => error!(span, "failed to load source file ({})", err), - })?; + let id = vm.ctx.sources.load(&full).at(span)?; // Prevent cyclic importing. if vm.route.contains(&id) { -- cgit v1.2.3