diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-11-21 11:22:01 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-11-21 11:22:01 (GMT) |
commit | 98ce25af617901be6af682a617c9b35abee2c548 (patch) | |
tree | 9e0af9c0fbcad14daf8bc95ee68ad11889e66f55 /generic/tclPkg.c | |
parent | acc567c30fad3492d34aba6035b858e9c72db07c (diff) | |
download | tcl-98ce25af617901be6af682a617c9b35abee2c548.zip tcl-98ce25af617901be6af682a617c9b35abee2c548.tar.gz tcl-98ce25af617901be6af682a617c9b35abee2c548.tar.bz2 |
A little more errorCode goodness
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; } |