libexpr: explicitly sanity check --ignore-try when entering debugger

This case _should_ never happen.

Text is based on `//lix/libmain/crash-handler.cc`.

Change-Id: I0d11b0254bb107573f35216110236ba25a3c9537
This commit is contained in:
Dusk Banks
2025-01-31 00:35:15 -08:00
parent 3a41bf32a7
commit bfce4da6a2
+7 -2
View File
@@ -742,8 +742,13 @@ void DebugState::onEvalError(const EvalError * error, const Env & env, const Exp
{
printError("%s\n", error->what());
if (trylevel > 0 && error->info().level != lvlInfo)
printError("This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL " to skip these.\n");
if (trylevel > 0 && error->info().level != lvlInfo) {
if (evalSettings.ignoreExceptionsDuringTry) {
printError("This exception occurred in a 'tryEval' call, " ANSI_RED "despite the use of " ANSI_GREEN "--ignore-try" ANSI_RED " to attempt to skip these" ANSI_NORMAL ". This is probably a bug. We would appreciate if you report it along with what caused it at https://git.lix.systems/lix-project/lix/issues.\n");
} else {
printError("This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL " to skip these.\n");
}
}
}
auto se = staticEnvFor(expr);