Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-02-10
05:37 • Closed ticket [1309482fff]: retrieve precise line number in case of error pl... artifact: 51ce344d93 user: hobbs
2006-10-10
22:07 • Ticket [1309482fff]: 5 changes artifact: f1624cac6f user: dgp
2005-09-30
23:10 • Ticket [1309482fff]: 2 changes artifact: 9b3a3ead80 user: nicolascastagne
13:22 • New ticket [1309482fff]. artifact: 029c23c57c user: nicolascastagne

retrieve precise line number in case of error

Closed / Fixed1309482fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 20 years ago
Descriptionplain2005-09-30 13:22:30
When using Tcl embeded in a C/C++ application in order to 
execute scripts writen by end users, it would be useful to  
easily display basic debug information to the user in case 
an error occurs. 
Among these (and as minima) the error line on which the 
error occured. 
 
Today, the errorline registered is not sufficiently precise for 
a end user.  
 
Consider the following rather simple example : 
 
 1    if 1 { 
 2        set a 2 
 3        set a 2 3 
 4    } 
 
The error is on line 3. 
Now, if we have in the C application : 
 
    result = Tcl_EvalEx(tclInterp, script, length,  
TCL_EVAL_GLOBAL); 
        if (result != TCL_OK ) { 
           Tcl_Obj *options = Tcl_GetReturnOptions(tclInterp, 
result); 
           Tcl_Obj *key = Tcl_NewStringObj("-errorline", -1); 
           Tcl_Obj *errorline; 
           Tcl_DictObjGet(NULL, options, key, &errorline); 
           printf(" ERROR line %s\n", Tcl_GetString(errorline)); 
    } 
 
the output is "ERROR line 1". 
 
Basically, the error line is not retrieved within the nested 
script of the "if" command. 
 
It would be useful to get : 
- the error line 
- the name of the procedure 
whatever the level of 'nesting' is is a script. 
 
------ 
I propose the feature request on the behalf of Don Porter, 
who asked me to do so on comp.lang.tcl
nicolascastagne Ticket [1309482fff]: 2 changes [History diff]2005-09-30 23:10:23
dgpplain2006-10-10 22:07:40
Logged In: YES 
user_id=80530


See TIP 280.
hobbsplain2007-02-10 05:37:40
Logged In: YES 
user_id=72656
Originator: NO

TIP 280 in 8.5 now.
Log in (anonymous is fine) to add a comment.