Thread: [tcljava-user] JACL 1.4 - no line numbers on error.
Brought to you by:
mdejong
From: Patrick F. <fin...@gm...> - 2007-04-19 10:26:01
|
Jacl seems to behave differently to Tcl in that it does not produce line numbers with the error messages. With WebSphere: WASX7017E: Exception received while running file "C:\home\patrick\eclipse\WSAdminCVS\WSAdmin\WAS5.1\JACL\installCluster.tcl"; exception information: com.ibm.bsf.BSFException: error while eval'ing Jacl expression: extra switch pattern with no body Even if I wrap the "switch statement" in a catch I still don't get a line number. if { [ catch { switch xxxxx-exact -- $secondName { name { set nameList [ list $secondName [ lindex $a 1 ] ] } description { set descriptionList [ list $secondName [ lindex $a 1 ] ] } enableHA { set enableHAList [ list $secondName [ lindex $a 1 ] ] } preferLocal { set preferLocalList [ list $secondName [ lindex $a 1 ] ] } serverType { set serverTypeList [ list $secondName [ lindex $a 1 ] ] } } } r ] != 0 } { return -code error $r } |
From: Patrick F. <fin...@gm...> - 2007-09-07 06:50:53
|
I had a look at some of the threads on the comp.lang.tcl newsgroup and it seems that "catch" destroys the error location information when the stack unwinds http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/4dd1c0a1eba12999/840020cf40ca2f9f?lnk=gst&q=%2B%22error%22%2B%22catch%22&rnum=6#840020cf40ca2f9f The recommendation is to throw an error after the catch to trigger the stack trace but I find that in Jacl "return -code error $r" does not generate the error information. E.G if { [ catch { $AdminConfig yabba } r ] == 0 } { set donothing true } else { return -code error $r } gives............... WASX7017E: Exception received while running file "C:\home\patrick\eclipse\WASAdminSBV\WSAdmin\WAS6.1\JACL\installCluster.tcl"; exception information: com.ibm.bsf.BSFException: error while eval'ing Jacl expression: no accessible method "yabba" in class com.ibm.ws.scripting.AdminConfigClient invoked from within "::installCluster::installCluster $propertiesFile " I found that one way to trigger a full error stack is to insert an invalid command option. if { [ catch { $AdminConfig yabba } r ] == 0 } { set donothing true } else { "return -code error $r $::errorInfo $::errorCode" } gives.................... WASX7017E: Exception received while running file "C:\home\patrick\eclipse\WASAdminSBV\WSAdmin\WAS6.1\JACL\installCluster.tcl"; exception information: com.ibm.bsf.BSFException: error while eval'ing Jacl expression: bad option "no accessible method "yabba" in class com.ibm.ws.scripting.AdminConfigClient": must be -code, -errorcode, or -errorinfo while executing "return -code error $r $::errorInfo $::errorCode" ("if" else script line 5) invoked from within "if { [ catch { $AdminConfig yabba } r ] == 0 } { set donothing true } else { #return -code error $r re..." (procedure "::installCluster::installCluster" line 28) invoked from within "::installCluster::installCluster $propertiesFile " Is there a better way to preserve the error location information when using nested catches? |
From: Justin R. <ju...@ha...> - 2007-05-01 20:24:07
|
I ran your example in jaclsh and tclsh (running pure Tcl on a linux box) and I got the same exact message in both, without line numbers. So I don't believe this is a case of different behavior. I have seen Jacl provide line numbers, but thats in the case of a runtime error. Maybe this error, and the lack of a stack trace, pertains to parsing error? On 4/19/07, Patrick Finnegan <fin...@gm...> wrote: > > Jacl seems to behave differently to Tcl in that it does not produce line > numbers with the error messages. > > With WebSphere: > > WASX7017E: Exception received while running file > "C:\home\patrick\eclipse\WSAdminCVS\WSAdmin\WAS5.1\JACL\installCluster.tcl"; > exception information: com.ibm.bsf.BSFException: error while eval'ing Jacl > expression: extra switch pattern with no body > > Even if I wrap the "switch statement" in a catch I still don't get a line > number. > > > if { [ catch { > > switch xxxxx-exact -- $secondName { > > name { > > set nameList [ list $secondName [ lindex $a 1 ] ] > > } > > description { > > set descriptionList [ list $secondName [ lindex $a 1 ] ] > > } > > enableHA { > > set enableHAList [ list $secondName [ lindex $a 1 ] ] > > } > > preferLocal { > > set preferLocalList [ list $secondName [ lindex $a 1 ] ] > > } > > serverType { > > set serverTypeList [ list $secondName [ lindex $a 1 ] ] > > } > > > } > > } r ] != 0 } { > > return -code error $r > > } > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > tcljava-user mailing list > tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcljava-user > > |