From 21ce4b3cf6ba5f1f545319f46b02fd2018e4df98 Mon Sep 17 00:00:00 2001 From: TetzkatLipHoka Date: Sat, 11 Jul 2026 11:26:31 +0200 Subject: [PATCH] Report which LoadData stage failed instead of failing silently Several failure paths inside LoadTypes/LoadProcs/LoadVars only return False without calling CMD_Err. LoadData then cleared the instance and returned False with ExceptionCode still erNoError, so hosts printing TIFErrorToString(ExceptionCode, ExceptionString) showed 'No Error' for a failed load. Each stage now reports a stage-specific erCustomError - but only when no more specific error is pending (ExEx = erNoError), so existing detailed errors like 'Out Of Range' or 'Unexpected End Of File' are preserved. Co-Authored-By: Claude Fable 5 --- Source/uPSRuntime.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/uPSRuntime.pas b/Source/uPSRuntime.pas index d22c6182..24bf94f4 100644 --- a/Source/uPSRuntime.pas +++ b/Source/uPSRuntime.pas @@ -3063,16 +3063,22 @@ function TPSExec.LoadData(const s: tbtString): Boolean; if not LoadTypes then begin Clear; + if ExEx = erNoError then + CMD_Err2(erCustomError, TbtString('Failed to load types')); exit; end; if not LoadProcs then begin Clear; + if ExEx = erNoError then + CMD_Err2(erCustomError, TbtString('Failed to load procedures')); exit; end; if not LoadVars then begin Clear; + if ExEx = erNoError then + CMD_Err2(erCustomError, TbtString('Failed to load variables')); exit; end; if (HDR.MainProcNo >= FProcs.Count) and (HDR.MainProcNo <> InvalidVal)then begin