feat(tvix/eval): context-aware abort

Change-Id: Id5a435961ce3a2a2240b3936ea48515650d445d6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10427
Autosubmit: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Ryan Lahfa 2023-12-26 00:39:49 +01:00 committed by clbot
parent 4a3aa05c8f
commit 375f7eaa59

View file

@ -83,7 +83,11 @@ mod pure_builtins {
#[builtin("abort")]
async fn builtin_abort(co: GenCo, message: Value) -> Result<Value, ErrorKind> {
// TODO(sterni): coerces to string
Err(ErrorKind::Abort(message.to_str()?.to_string()))
// Although `abort` does not make use of any context,
// we must still accept contextful strings as parameters.
// If `to_str` was used, this would err out with an unexpected type error.
// Therefore, we explicitly accept contextful strings and ignore their contexts.
Err(ErrorKind::Abort(message.to_contextful_str()?.to_string()))
}
#[builtin("add")]