about summary refs log tree commit diff
path: root/tvix/eval/src/value/attrs.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-12T13·12+0300
committertazjin <tazjin@tvl.su>2022-09-13T14·41+0000
commit0f59fe66015580612ee79a9e9e985eaa0fa495e6 (patch)
tree5b709005b5652d04bc20cd2dfb8a6784af6f4f8b /tvix/eval/src/value/attrs.rs
parent7fd7a4465b4357654af51bf7914e438932141f31 (diff)
feat(tvix/eval): implement initial fancy formatting for errors r/4836
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 <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/value/attrs.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index b8ae51bf48..4c18ad2f55 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)),
             }
         }