summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvLine.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-21 08:11:21 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-21 08:11:21 (GMT)
commited7fb54396eee6e5122bfe611b2a14cf422970fa (patch)
tree2155194029aa5ccfd6cdf90913ff12109c494add /generic/tkCanvLine.c
parentf4db69f3300fe5cdb3da35c67bf608674950a72c (diff)
downloadtk-ed7fb54396eee6e5122bfe611b2a14cf422970fa.zip
tk-ed7fb54396eee6e5122bfe611b2a14cf422970fa.tar.gz
tk-ed7fb54396eee6e5122bfe611b2a14cf422970fa.tar.bz2
consistent error formatting, added error codes
Diffstat (limited to 'generic/tkCanvLine.c')
-rw-r--r--generic/tkCanvLine.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index e2dd8d3..d631c64 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -394,10 +394,12 @@ LineCoords(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"wrong # coordinates: expected an even number, got %d",
objc));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "LINE", NULL);
return TCL_ERROR;
} else if (objc < 4) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"wrong # coordinates: expected at least 4, got %d", objc));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "LINE", NULL);
return TCL_ERROR;
}
@@ -1748,15 +1750,7 @@ GetLineIndex(
if (strncmp(string, "end", (unsigned) length) == 0) {
*indexPtr = 2*linePtr->numPoints;
} else {
- /*
- * Some of the paths here leave messages in interp->result, so we
- * have to clear it out before storing our own message.
- */
-
- badIndex:
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
- return TCL_ERROR;
+ goto badIndex;
}
} else if (string[0] == '@') {
int i;
@@ -1797,6 +1791,17 @@ GetLineIndex(
}
}
return TCL_OK;
+
+ /*
+ * Some of the paths here leave messages in interp->result, so we have to
+ * clear it out before storing our own message.
+ */
+
+ badIndex:
+ Tcl_ResetResult(interp);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEMINDEX", "LINE", NULL);
+ return TCL_ERROR;
}
/*
@@ -1910,8 +1915,10 @@ ParseArrowShape(
syntaxError:
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad arrow shape \"", value,
- "\": must be list with three numbers", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad arrow shape \"%s\": must be list with three numbers",
+ value));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "ARROWSHAPE", NULL);
if (argv != NULL) {
ckfree(argv);
}
@@ -2012,8 +2019,10 @@ ArrowParseProc(
return TCL_OK;
}
- Tcl_AppendResult(interp, "bad arrow spec \"", value,
- "\": must be none, first, last, or both", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad arrow spec \"%s\": must be none, first, last, or both",
+ value));
+ Tcl_SetErrorCode(interp, "TK", "CANVAS", "ARROW", NULL);
*arrowPtr = ARROWS_NONE;
return TCL_ERROR;
}