The Tcl error command writes the specified message to stderr adding to it a prefix “Error: “.
Is it possible to change that prefix with something else like “ERROR: ” or “MyError: ” ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
errorcommand itself does not write anything to anywhere other than the Tcl result. What it actually does is throw an exception (of type “error”; TCL_ERROR at the C API level). The code that prefixes it with “Error:” is just the standard fallback handler, but you can use your own by having your main script usecatchto trap any result and decide what to do with it (ortry …from 8.6 onwards, which is easier to use when trapping specific problems).OK, if you’re using 8.5 then a slightly better way to write that is:
There’s lots of other interesting stuff in the result dictionary, which you might or might not be interested in. Have a poke around.