diff options
author | dkf <dkf@noemail.net> | 2007-11-21 11:22:01 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2007-11-21 11:22:01 (GMT) |
commit | 1e8645e5056bf182df37d23927a0d9a6affdf230 (patch) | |
tree | 9e0af9c0fbcad14daf8bc95ee68ad11889e66f55 /generic/tclPkg.c | |
parent | 23bda63943c86504dd20b23ad491d2f8e56a1fa5 (diff) | |
download | tcl-1e8645e5056bf182df37d23927a0d9a6affdf230.zip tcl-1e8645e5056bf182df37d23927a0d9a6affdf230.tar.gz tcl-1e8645e5056bf182df37d23927a0d9a6affdf230.tar.bz2 |
A little more errorCode goodness
FossilOrigin-Name: b9874122269c67c0f048e21d7370369d6741a0ec
Diffstat (limited to 'generic/tclPkg.c')
-rw-r--r-- | generic/tclPkg.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/generic/tclPkg.c b/generic/tclPkg.c index abc0070..8431eca 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPkg.c,v 1.32 2007/11/18 22:30:10 dkf Exp $ + * RCS: @(#) $Id: tclPkg.c,v 1.33 2007/11/21 11:22:01 dkf Exp $ * * TIP #268. * Heavily rewritten to handle the extend version numbers, and extended @@ -690,15 +690,20 @@ Tcl_PkgPresentEx( if (hPtr) { pkgPtr = Tcl_GetHashValue(hPtr); if (pkgPtr->version != NULL) { - /* * At this point we know that the package is present. Make sure * that the provided version meets the current requirement by * calling Tcl_PkgRequireEx() to check for us. */ - return Tcl_PkgRequireEx(interp, name, version, exact, - clientDataPtr); + const char *foundVersion = Tcl_PkgRequireEx(interp, name, version, + exact, clientDataPtr); + + if (foundVersion == NULL) { + Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "PACKAGE", name, + NULL); + } + return foundVersion; } } @@ -708,6 +713,7 @@ Tcl_PkgPresentEx( } else { Tcl_AppendResult(interp, "package ", name, " is not present", NULL); } + Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "PACKAGE", name, NULL); return NULL; } |