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 <tazjin@tvl.su>
Autosubmit: Adam Joseph <adam@westernsemico.com>
This commit is contained in:
Adam Joseph 2023-09-09 00:10:06 -07:00 committed by clbot
parent 6015604bd8
commit 926459ce69
5 changed files with 57 additions and 29 deletions

View file

@ -21,7 +21,7 @@ use crate::{
chunk::Chunk,
cmp_op,
compiler::GlobalsMap,
errors::{Error, ErrorKind, EvalResult},
errors::{CatchableErrorKind, Error, ErrorKind, EvalResult},
io::EvalIO,
nix_search_path::NixSearchPath,
observer::RuntimeObserver,
@ -925,7 +925,10 @@ impl<'o> VM<'o> {
}
OpCode::OpAssertFail => {
frame.error(self, ErrorKind::AssertionFailed)?;
frame.error(
self,
ErrorKind::CatchableErrorKind(CatchableErrorKind::AssertionFailed),
)?;
}
// Data-carrying operands should never be executed,