TclBlend: Blending Tcl and Java

By Scott Stanton

Dr. Dobb's Journal February 1998

set obj [java::new Simple3]
if {[catch {$obj fails} msg]} {
    puts "Got error: '$msg'"
    set exception [lindex $::errorCode 1]
    $exception printStackTrace
}
=>
Got error: 'java.lang.IllegalArgumentException: Bad argument'
java.lang.IllegalArgumentException: Bad argument
        at Simple3.fails(Simple3.java:4)
        at tcl.lang.Invoke.call(Invoke.java:451)
        at tcl.lang.Invoke.callMethod(Invoke.java:134)

Example 4: How a script might process an exception that was thrown during a method invocation.

Back to Article


Copyright © 1998, Dr. Dobb's Journal