diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-26 12:12:14 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-26 12:12:14 (GMT) |
commit | 5d8e6c3cce8cdfbf23d812e1048233a2357c8edc (patch) | |
tree | 480cd4c8cb8167b7058fd79c5423816e8d078196 | |
parent | a4188bb98c1fdf3fff44c3552a26944064b0e8b1 (diff) | |
download | tcl-5d8e6c3cce8cdfbf23d812e1048233a2357c8edc.zip tcl-5d8e6c3cce8cdfbf23d812e1048233a2357c8edc.tar.gz tcl-5d8e6c3cce8cdfbf23d812e1048233a2357c8edc.tar.bz2 |
More generation of errorCode information.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | generic/tclNamesp.c | 6 |
2 files changed, 9 insertions, 0 deletions
@@ -1,5 +1,8 @@ 2011-03-26 Donal K. Fellows <dkf@users.sf.net> + * generic/tclNamesp.c (Tcl_Export, Tcl_Import, DoImport): More + generation of errorCode information. + * generic/tclCompExpr.c, generic/tclCompile.c, generic/tclExecute.c: * generic/tclListObj.c, generic/tclNamesp.c, generic/tclObj.c: * generic/tclStringObj.c, generic/tclUtil.c: Reduce the number of diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 62ead7d..3a08221 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -1335,6 +1335,7 @@ Tcl_Export( if ((exportNsPtr != nsPtr) || (strcmp(pattern, simplePattern) != 0)) { Tcl_AppendResult(interp, "invalid export pattern \"", pattern, "\": pattern can't specify a namespace", NULL); + Tcl_SetErrorCode(interp, "TCL", "EXPORT", "INVALID", NULL); return TCL_ERROR; } @@ -1539,6 +1540,7 @@ Tcl_Import( if (strlen(pattern) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("empty import pattern",-1)); + Tcl_SetErrorCode(interp, "TCL", "IMPORT", "EMPTY", NULL); return TCL_ERROR; } TclGetNamespaceForQualName(interp, pattern, nsPtr, @@ -1556,10 +1558,12 @@ Tcl_Import( Tcl_AppendResult(interp, "no namespace specified in import pattern \"", pattern, "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "IMPORT", "ORIGIN", NULL); } else { Tcl_AppendResult(interp, "import pattern \"", pattern, "\" tries to import from namespace \"", importNsPtr->name, "\" into itself", NULL); + Tcl_SetErrorCode(interp, "TCL", "IMPORT", "SELF", NULL); } return TCL_ERROR; } @@ -1681,6 +1685,7 @@ DoImport( "\" would create a loop containing command \"", Tcl_DStringValue(&ds), "\"", NULL); Tcl_DStringFree(&ds); + Tcl_SetErrorCode(interp, "TCL", "IMPORT", "LOOP", NULL); return TCL_ERROR; } } @@ -1720,6 +1725,7 @@ DoImport( } Tcl_AppendResult(interp, "can't import command \"", cmdName, "\": already exists", NULL); + Tcl_SetErrorCode(interp, "TCL", "IMPORT", "OVERWRITE", NULL); return TCL_ERROR; } return TCL_OK; |