Page 1 of 1 1
Topic Options
#183235 - 2007-12-03 11:57 PM Line Error Bug when using Execute()
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Dear Ruud et. al.,

KiXtart doesn't return the correct line where an error is found when using Execute(). Please check out the following code...

 Code:
? "Line 1"
? "Line 2"
$=Execute("$x="+$y)

Output:
 Code:
Line 1
Line 2
ERROR : Error in expression.!
Script: C:\svn\scripts\test.kix
Line  : 1

Regards,

Richard

Top
#183238 - 2007-12-04 12:54 AM Re: Line Error Bug when using Execute() [Re: It_took_my_meds]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
If this is considered a bug, I've seen this long before 4.60.
_________________________
(... better days ahead)

Top
#183239 - 2007-12-04 12:57 AM Re: Line Error Bug when using Execute() [Re: Allen]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
So have I. It's been around for a long time, I just hadn't been bothered to report it in the past.
Top
#183246 - 2007-12-04 09:32 AM Re: Line Error Bug when using Execute() [Re: It_took_my_meds]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Hmmm. Tricky one.

It is actually reporting the correct line. The problem is that there is a bit of information missing, and a bit of information which is misleading.

The reason it is so confusing is that the error is occurring in the Executed() code, *not* the test.kix code.

The code in the Execute() is has it's own context including line numbers, and your error is occurring on line 1 of the executed code.

Try the following example:
 Code:
"Line 1" ?
"Line 2" ?
$=Execute("'foo' ?"+@CRLF+"$x="+$y)


Now you will find that KiXtart (correctly) reports the error on line 2.

Think of Execute() as being a little like CALLing another script and the reason for the confusion becomes clearer.

The big problem is that the error message says that the error is in "test.kix". Although that is true, it is also very misleading. If the error message said that the error was in "executed code" at least it would point you in the right direction.

The best solution would be some sort of callback trace displaying the return stack, something like:
 Code:
ERROR : Error in expression.!
Script: Executed() Code
Line  : 2
Script: C:\svn\scripts\test.kix
Line  : 3

Top
#188012 - 2008-06-03 01:55 PM Re: Line Error Bug when using Execute() [Re: Richard H.]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Richard is spot on: the error is in the executed code, hence the "line 1".

I can see how the error is confusing, and I'll see if I can change the message.

Ruud

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1447 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.047 seconds in which 0.021 seconds were spent on a total of 13 queries. Zlib compression enabled.