Tcl Learning-Error | exception

Source: Internet
Author: User

L errorinfo: -- error message

If the program is wrong, the TCL parser will give the error back to the application, and the program decides what to do with it. If there are no other measures, the error message will usually be printed on the screen, and this is errorinfo responsible for processing.

L ErrorCode: -- error code

TCL provides another global variable, errorcode, which provides information about the error condition. The format is easily handled by TCL scripts, and it is often used to recover from errors using the Catch command in a TCL script. The errorcode variable contains a list of one or more elements. The first element describes the normal type of error, and other elements provide more information about the type.

L Error : -- wrong display

Tcl errors may be generated by C code or built-in commands that implement the TCL interpreter or by TCL command error, for example:

L catch: -- catch Exception

For example, open a nonexistent file, will be an error:

With the catch command, the error message is not displayed and the program is not terminated.

Catch can accept the second argument: to save an error message


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Tcl Learning-Error | exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.