wizards/source/scriptforge/SF_Exception.xba |    8 ++++----
 wizards/source/scriptforge/SF_Session.xba   |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit fc36eed73e5033a34698c30801f159d533018b08
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Wed Oct 16 14:45:37 2024 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Wed Oct 16 17:47:14 2024 +0200

    ScriptForge session.ExecuteCalcFunction error handling
    
    1) Error handling in the ExecuteCalcFunction()
       function must be conditioned by the global
       error handling.
       True; display a user-friendly message
       False: abort on the erroneous line
    
       So far, an ambiguous error message was displayed
       in both cases.
    
    2) Above ambiguous error message was corrupted
       by the detour to SF_Array.Prepend() method
       in exc.RaiseFatal() and exc.RaiseAbort().
       A simple workaround fixes the ambiguity
       about the name of the faulty routine.
    
    Change-Id: Iab38b48e6291e1960fc288696a7ebd18ffe8ebae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175020
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins

diff --git a/wizards/source/scriptforge/SF_Exception.xba 
b/wizards/source/scriptforge/SF_Exception.xba
index 02259ffc329b..9e27c5202124 100644
--- a/wizards/source/scriptforge/SF_Exception.xba
+++ b/wizards/source/scriptforge/SF_Exception.xba
@@ -709,7 +709,7 @@ Const cstSubArgs = &quot;[Source=Erl]&quot;
        &apos;  Save Err, Erl, .. values before any On Error ... statement
        SF_Exception._CaptureSystemError()
        On Local Error Resume Next
-       
+
 Check:
        If IsMissing(Source) Or IsEmpty(Source) Then Source = &quot;&quot;
 
@@ -720,7 +720,7 @@ Try:
                Set L10N = _SF_._GetLocalizedInterface()
                If Len(_SF_.MainFunction) &gt; 0 Then   &apos;  MainFunction = 
[Library.]Module.Method
                        vLocation = Split(_SF_.MainFunction, &quot;.&quot;)
-                       If UBound(vLocation) &lt; 2 Then vLocation = 
SF_Array.Prepend(vLocation, &quot;ScriptForge&quot;)
+                       If UBound(vLocation) &lt; 2 Then vLocation = 
Split(&quot;ScriptForge.&quot; &amp; _SF_.MainFunction, &quot;.&quot;)
                        sLocation = L10N.GetText(&quot;VALIDATESOURCE&quot;, 
vLocation(0), vLocation(1), vLocation(2)) &amp; &quot;


&quot;
                Else
                        sLocation = &quot;&quot;
@@ -779,7 +779,7 @@ Const cstStop = &quot;⏻&quot;               &apos; Chr(9211)
        &apos;  Save Err, Erl, .. values before any On Error ... statement
        SF_Exception._CaptureSystemError()
        If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
-       
+
 Check:
        If IsMissing(ErrorCode) Or IsEmpty(ErrorCode) Then ErrorCode = 
&quot;&quot;
        If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
@@ -791,7 +791,7 @@ Try:
        &apos;  Location header common to all error messages
        If Len(_SF_.MainFunction) &gt; 0 Then   &apos;  MainFunction = 
[Library.]Module.Method
                vLocation = Split(_SF_.MainFunction, &quot;.&quot;)
-               If UBound(vLocation) &lt; 2 Then vLocation = 
SF_Array.Prepend(vLocation, &quot;ScriptForge&quot;)
+                       If UBound(vLocation) &lt; 2 Then vLocation = 
Split(&quot;ScriptForge.&quot; &amp; _SF_.MainFunction, &quot;.&quot;)
                sService = vLocation(1)
                sMethod = vLocation(2)
                sLocation = L10N.GetText(&quot;VALIDATESOURCE&quot;, 
vLocation(0), sService, sMethod) _
diff --git a/wizards/source/scriptforge/SF_Session.xba 
b/wizards/source/scriptforge/SF_Session.xba
index 1eb34916a0e3..ebde30256c7f 100644
--- a/wizards/source/scriptforge/SF_Session.xba
+++ b/wizards/source/scriptforge/SF_Session.xba
@@ -223,7 +223,7 @@ Try:
        If UBound(pvArgs) = 0 Then
                If IsEmpty(pvArgs(0)) Then pvArgs = Array()
        End If
-       On Local Error GoTo CatchCall
+       If SF_Utils._ErrorHandling() Then On Local Error GoTo CatchCall
        vReturn = oCalc.callFunction(UCase(CalcFunction), pvArgs())
 
 Finally:

Reply via email to