about summary refs log tree commit diff
path: root/tvix/eval/src/vm/mod.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-03-12T18·49+0300
committerclbot <clbot@tvl.fyi>2023-03-17T19·31+0000
commit5095e4f2696ef85ee7c6ae0515eb8d1586459f8c (patch)
tree8a7a6c5d17fa73a430256a170b80358e2d21f189 /tvix/eval/src/vm/mod.rs
parentea80e0d3f88576ef593b1f9237bd51da9c3f335b (diff)
feat(tvix/eval): add generator "name" to NativeError kind r/6024
This produces traces in which we can see what kind of native code was
run. Note that these "names" are named after the generator message, so
these aren't *really* intended for end-user consumption, but we can
give them saner names later.

Example:
https://gist.github.com/tazjin/82b24e92ace8e821008954867ee05057

This already makes the traces a little easier to parse.

Change-Id: Idcd601baf84f492211b732ea0f04b377112e10d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8268
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/vm/mod.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/tvix/eval/src/vm/mod.rs b/tvix/eval/src/vm/mod.rs
index 60039eab33..450d950b34 100644
--- a/tvix/eval/src/vm/mod.rs
+++ b/tvix/eval/src/vm/mod.rs
@@ -99,9 +99,14 @@ impl<T, S: GetSpan> WithSpan<T, S> for Result<T, ErrorKind> {
                             error =
                                 Error::new(ErrorKind::BytecodeError(Box::new(error)), span.span());
                         }
-                        Frame::Generator { span, .. } => {
-                            error =
-                                Error::new(ErrorKind::NativeError(Box::new(error)), span.span());
+                        Frame::Generator { name, span, .. } => {
+                            error = Error::new(
+                                ErrorKind::NativeError {
+                                    err: Box::new(error),
+                                    gen_type: name,
+                                },
+                                span.span(),
+                            );
                         }
                     }
                 }