From 47ced1720849a908ed78c0f0ab3bcd5da7722d4e Mon Sep 17 00:00:00 2001
From: dkf <donal.k.fellows@manchester.ac.uk>
Date: Fri, 20 Sep 2013 13:05:04 +0000
Subject: Potential fix for issues relating to lack of errorCode setting with
 unknown command handling.

---
 library/init.tcl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/library/init.tcl b/library/init.tcl
index 1ca6413..ff3a1e3 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -250,7 +250,8 @@ proc unknown args {
 	# Make sure we're not trying to load the same proc twice.
 	#
 	if {[info exists UnknownPending($name)]} {
-	    return -code error "self-referential recursion\
+	    return -code error -errorcode [list TCL LOOKUP COMMAND $name] \
+		    "self-referential recursion\
 		    in \"unknown\" for command \"$name\""
 	}
 	set UnknownPending($name) pending
@@ -399,10 +400,12 @@ proc unknown args {
 	    return -options $::tcl::UnknownOptions $::tcl::UnknownResult
 	}
 	if {[llength $cmds]} {
-	    return -code error "ambiguous command name \"$name\": [lsort $cmds]"
+	    return -code error -errorcode [list TCL LOOKUP COMMAND $name] \
+		    "ambiguous command name \"$name\": [lsort $cmds]"
 	}
     }
-    return -code error "invalid command name \"$name\""
+    return -code error -errorcode [list TCL LOOKUP COMMAND $name] \
+	    "invalid command name \"$name\""
 }
 
 # auto_load --
-- 
cgit v0.12

