diff options
Diffstat (limited to 'generic')
| -rw-r--r-- | generic/tclCmdIL.c | 8 | ||||
| -rw-r--r-- | generic/tclListObj.c | 25 |
2 files changed, 16 insertions, 17 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 07b41ac..08948ea 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3421,8 +3421,8 @@ Tcl_LsearchObjCmd( } if (encoded == (int)TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "index \"%s\" cannot select an element " - "from any list", TclGetString(indices[j]))); + "index \"%s\" out of range", + TclGetString(indices[j]))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" "OUTOFRANGE", NULL); result = TCL_ERROR; @@ -4142,8 +4142,8 @@ Tcl_LsortObjCmd( if ((result == TCL_OK) && (encoded == (int)TCL_INDEX_NONE)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "index \"%s\" cannot select an element " - "from any list", TclGetString(indexv[j]))); + "index \"%s\" out of range", + TclGetString(indexv[j]))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" "OUTOFRANGE", NULL); result = TCL_ERROR; diff --git a/generic/tclListObj.c b/generic/tclListObj.c index bae6452..5de2eac 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1608,11 +1608,10 @@ TclLsetFlat( || (valuePtr == NULL && index >= elemCount)) { /* ...the index points outside the sublist. */ if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list index out of range", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", - valuePtr == NULL ? "LPOP" : "LSET", - "BADINDEX", NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "index \"%s\" out of range", Tcl_GetString(indexArray[-1]))); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" + "OUTOFRANGE", NULL); } result = TCL_ERROR; break; @@ -1803,10 +1802,10 @@ TclListObjSetElement( (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list index out of range", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", - "BADINDEX", NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "index \"%d\" out of range", index)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", + "OUTOFRANGE", NULL); } return TCL_ERROR; } @@ -1825,10 +1824,10 @@ TclListObjSetElement( if (index<0 || index>=elemCount) { if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list index out of range", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", "BADINDEX", - NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "index \"%d\" out of range", index)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", + "OUTOFRANGE", NULL); } return TCL_ERROR; } |
