From 926459ce694536432c36d8f0d3fb25b821945852 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 9 Sep 2023 00:10:06 -0700 Subject: refactor(tvix/eval): factor CatchableErrorKind out of ErrorKind This commit creates a separate enum for "catchable" errors (the kind that `builtins.tryEval` can detect). Change-Id: Ie81d1112526d852255d9842f67045f88eab192af Reviewed-on: https://cl.tvl.fyi/c/depot/+/9287 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: Adam Joseph --- tvix/eval/src/builtins/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/builtins/mod.rs') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index d701fa08a08d..322f91710898 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -17,7 +17,7 @@ use crate::vm::generators::{self, GenCo}; use crate::warnings::WarningKind; use crate::{ self as tvix_eval, - errors::ErrorKind, + errors::{CatchableErrorKind, ErrorKind}, value::{CoercionKind, NixAttrs, NixList, NixString, SharedThunkSet, Thunk, Value}, }; @@ -893,7 +893,9 @@ mod pure_builtins { #[builtin("throw")] async fn builtin_throw(co: GenCo, message: Value) -> Result { - Err(ErrorKind::Throw(message.to_str()?.to_string())) + Err(ErrorKind::CatchableErrorKind(CatchableErrorKind::Throw( + message.to_str()?.to_string(), + ))) } #[builtin("toString")] -- cgit 1.4.1