Skip to content

Commit ebcc83c

Browse files
committed
EvaluteRTE: Correctly report AbortOnValue aborts with negative abort codes
We need to assume that all error codes not being -1, -2, -3, -4 are from AbortOnValue as we can't differentiate them. This now correctly reports AbortOnValue aborts with negative abort codes. Broken since a7ab54c (More detailed RTE error message, 2017-03-07). It did not help that the Igor Pro documentation is also wrong in this regard.
1 parent b87bf2e commit ebcc83c

3 files changed

Lines changed: 37 additions & 6 deletions

File tree

procedures/igortest-basics.ipf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,14 @@ static Function EvaluateRTE(err, errmessage, abortCode, funcName, funcType, proc
453453
IUTF_Reporting#AddError(str, IUTF_STATUS_ERROR)
454454
break
455455
default:
456+
if(abortCode != 0)
457+
sprintf str, "Encountered \"AbortOnValue\" Code %d in %s \"%s\" (%s)", abortCode, funcTypeString, funcName, procWin
458+
IUTF_Reporting#AddFailedSummaryInfo(str)
459+
IUTF_Reporting#AddError(str, IUTF_STATUS_ERROR)
460+
endif
456461
break
457462
endswitch
458463
message += str
459-
if(abortCode > 0)
460-
sprintf str, "Encountered \"AbortOnValue\" Code %d in %s \"%s\" (%s)", abortCode, funcTypeString, funcName, procWin
461-
IUTF_Reporting#AddFailedSummaryInfo(str)
462-
IUTF_Reporting#AddError(str, IUTF_STATUS_ERROR)
463-
message += str
464-
endif
465464
endif
466465

467466
IUTF_Reporting#ReportError(message, incrGlobalErrorCounter = 0)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#pragma rtGlobals=3
2+
#pragma TextEncoding="UTF-8"
3+
#pragma rtFunctionErrors=1
4+
#pragma version=1.10
5+
#pragma ModuleName=TEST_Aborted
6+
7+
static Function TEST_CASE_BEGIN_OVERRIDE(string testcase)
8+
9+
variable/G root:historyRef = CaptureHistoryStart()
10+
End
11+
12+
static Function TEST_CASE_END_OVERRIDE(string testcase)
13+
14+
NVAR/SDFR=root: historyRef
15+
string/G root:history = CaptureHistory(historyRef, 1)
16+
End
17+
18+
// IUTF_EXPECTED_FAILURE
19+
static Function AbortWithNegativeValue()
20+
21+
AbortOnValue 1, -10
22+
End
23+
24+
static Function EvaluateAbortWithNegativeValue()
25+
26+
SVAR/SDFR=root: history
27+
28+
INFO("%s", s0 = history)
29+
30+
CHECK_GE_VAR(strsearch(history, "Encountered \"AbortOnValue\" Code -10 in test case \"TEST_Aborted#AbortWithNegativeValue\" (AbortedTestcases.ipf)", 0), 0)
31+
End

tests/UnitTests/main.ipf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include ":Tracing:ComplexityTests"
1111
#include ":Utils:PathsTests"
1212
#include ":Utils:StringsTests"
13+
#include ":Utils:AbortedTests"
1314

1415
#undef UTF_ALLOW_TRACING
1516
#if Exists("TUFXOP_Version")

0 commit comments

Comments
 (0)