From bfce4da6a2cdc04f1623cb32f3f1d250ba1f2aab Mon Sep 17 00:00:00 2001 From: Dusk Banks Date: Wed, 29 Jan 2025 00:51:46 -0800 Subject: [PATCH] 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 --- lix/libexpr/eval.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lix/libexpr/eval.cc b/lix/libexpr/eval.cc index f7b28da50..f7622cbbb 100644 --- a/lix/libexpr/eval.cc +++ b/lix/libexpr/eval.cc @@ -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);