From 5095e4f2696ef85ee7c6ae0515eb8d1586459f8c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 12 Mar 2023 21:49:29 +0300 Subject: feat(tvix/eval): add generator "name" to NativeError kind 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 Tested-by: BuildkiteCI Autosubmit: tazjin --- tvix/eval/src/vm/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tvix/eval/src/vm') diff --git a/tvix/eval/src/vm/mod.rs b/tvix/eval/src/vm/mod.rs index 60039eab3342..450d950b34a6 100644 --- a/tvix/eval/src/vm/mod.rs +++ b/tvix/eval/src/vm/mod.rs @@ -99,9 +99,14 @@ impl WithSpan for Result { 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(), + ); } } } -- cgit 1.4.1