From b7f71f558179027eaabc97b95baa54cd21ff40d6 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 17 Nov 2020 11:36:53 +0000 Subject: [PATCH] feat: better Display for ImportSyntaxError --- --- a/crates/jrsonnet-evaluator/src/error.rs +++ b/crates/jrsonnet-evaluator/src/error.rs @@ -78,7 +78,11 @@ ImportBadFileUtf8(PathBuf), #[error("tried to import {1} from {0}, but imports is not supported")] ImportNotSupported(PathBuf, PathBuf), - #[error("syntax error")] + #[error( + "syntax error, expected one of {}, got {:?}", + .error.expected, + .source_code.chars().nth(error.location.offset).map(|c| c.to_string()).unwrap_or("EOF".into()) + )] ImportSyntaxError { path: Rc, source_code: Rc, -- gitstuff