auto_load errors: don't prune errorInfo
Closed / Fixed218685ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:04:07
OriginalBugID: 1734 RFE
Version: 8.1b2
SubmitDate: '1999-04-06'
LastModified: '2000-02-01'
Severity: MED
Status: Released
Submitter: pat
ChangedBy: ericm
OS: All
FixedDate: '2000-02-01'
FixedInVersion: 8.3
ClosedDate: '2000-10-25'
Name:
Don Porter
Comments:
The same mis-feature is present in the 8.0.x sources. If this patch is
adopted, please apply it to both development branches.
DesiredBehavior:
When an error occurs in the auto-loading of a command, [unknown]
catches and re-raises the error. In the process, all details of
the calling stack trace are lost. This can make it difficult to
locate the cause of the error when debugging auto-load scripts.
[unknown] also prepends the string "error while autoloading \"$name\":
"
to the error message. This information says something about the
context
in which the error was raised, nothing about the error itself. The
proper
place to record context information about an error is in the global
errorInfo variable. When several auto-loads get nested, the prepended
strings add up to create a long confusing line before getting to the
point : what the error is.
The simple patch provided corrects both problems by preserving
$errorInfo
when re-raising the error, and appending to errorInfo the contextual
information that the error occured while autoloading.
Patch:
Index: init.tcl
===================================================================
RCS file: /cvsroot/tcl/library/init.tcl,v
retrieving revision 1.1.2.7
diff -c -r1.1.2.7 init.tcl
*** init.tcl 1999/03/13 23:49:48 1.1.2.7
--- init.tcl 1999/04/06 15:50:08
***************
*** 183,190 ****
set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg]
unset unknown_pending($name);
if {$ret != 0} {
! return -code $ret -errorcode $errorCode \
! "error while autoloading \"$name\": $msg"
}
if {![array size unknown_pending]} {
unset unknown_pending
--- 183,190 ----
set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg]
unset unknown_pending($name);
if {$ret != 0} {
! append errorInfo "\n (autoloading \"$name\")"
! return -code $ret -errorcode $errorCode -errorinfo $errorInfo $msg
}
if {![array size unknown_pending]} {
unset unknown_pending
PatchFiles:
init.tcl
I applied this patch to the 8.3 final sources. Thanks.
- eric
-- 02/01/2000 ericm
welch Closed ticket [218685ffff].
[History diff]2000-10-26 08:27:10
dgp Ticket [218685ffff]: 3 changes
[History diff]2001-04-06 02:08:30
Log in (anonymous is fine) to add a comment.