From 0f59fe66015580612ee79a9e9e985eaa0fa495e6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 12 Sep 2022 16:12:43 +0300 Subject: feat(tvix/eval): implement initial fancy formatting for errors This very closely follows the way it's done for warnings, but errors have a lot more information available in some cases which we do not surface yet. Note also that due to requiring the `CodeMap`, this is not yet called from eval.rs as the way that is threaded through needs to be refactored, so only the method for reporting these errors as strings is implemented so far. Next steps for this will be to add a generic diagnostics module that reduces some of the boilerplate for this between warnings & errors, and which will also give us a good point in the future to switch to a fancier diagnostics crate. Change-Id: If6bb209f8e7a568d866e516a90335b9b2afbf66d Reviewed-on: https://cl.tvl.fyi/c/depot/+/6534 Reviewed-by: grfn Tested-by: BuildkiteCI --- tvix/eval/src/value/attrs.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs index b8ae51bf48fc..4c18ad2f55b2 100644 --- a/tvix/eval/src/value/attrs.rs +++ b/tvix/eval/src/value/attrs.rs @@ -286,11 +286,7 @@ impl NixAttrs { continue; } - other => { - return Err(ErrorKind::InvalidAttributeName { - given: other.type_of(), - }) - } + other => return Err(ErrorKind::InvalidAttributeName(other)), } } -- cgit 1.4.1