Am 22.05.2017 um 23:06 schrieb Allin Cottrell:
On Mon, 22 May 2017, Allin Cottrell wrote:
> On Mon, 22 May 2017, Sven Schreiber wrote:
>> My first minor complaint is that here gretl's error
message could be
>> a bit more specific than just "invalid argument".
>
> Ah, that was specific to giving a variable rather than a numerical
> value for the lag order. Now fixed in git: either way you'll see
>
> Invalid lag order 0
thanks!
>> OK, so I'm trying to use "catch", and
immediately after the "catch
>> var" line I have:
...
>>
>> But: Now gretl, instead of printing the err and so on, throws another
>> error message "unpaired if" (re-translated from German).
I think I found the problem: on repeated errors in a loop,
"catch" could
stop working (that is, fail fully to nullify the error condition).
I show below an example which did not work properly before, but which
now does. Hopefully it exhibits the same problem as you found; if so the
issue is fixed in git.
A fix is always good, of course. However, I believe that my debug output
showed that the problem occurs when $error is non-zero for the first
time already.
I should perhaps mention that this is happening within a function, and
(I think) the lag order parameter should stay constant for each function
call. So I believe the following sequence of events applies roughly:
- function is executed, inside it we have "catch var..." working but not
reacting because everything is perfectly valid
- this happens many times, first because the "catch var" is also inside
a loop, and secondly because the function is called repeatedly
- then the same function is called with invalid lag order 0, and at the
first loop iteration "catch var..." should set $error to non-zero.
- But instead of executing the "if err ... endif" block correctly (and
perhaps failing afterwards), I got the unpaired-if error.
(This isn't with current git or snapshot, just re-telling the story.)
thanks,
sven