| Description: |
Error that occurs in destructor overrides error from constructor, so I am unable to get stack trace or error message from original error.
Example:
package require Tcl 8.5
package require snit
snit::type Test {
constructor {} {
error "ctor error"
}
destructor {
error "dtor error"
}
}
catch {Test create %AUTO%} err opts
puts err=$err
puts opts=$opts
Execution result:
$ tclsh8.5 snit-bug.tcl
err=dtor error
opts=-code 1 -level 0 -errorcode NONE -errorinfo {dtor error
while executing
"error "dtor error""
(procedure "::Test::Snit_destructor" line 4)
invoked from within
"${type}::Snit_destructor $type $selfns $win $instance"
(procedure "::snit::RT.DestroyObject" line 16)
invoked from within
"::snit::RT.DestroyObject $type $selfns $name"
(procedure "::snit::RT.type.typemethod.create" line 55)
invoked from within
"Test create %AUTO%"} -errorline 1
There are no any information about "ctor error".
I suggest to add constructor error and stack trace to destructor error to provide more useful information for error analysis.
|