11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Caché</strong> <strong>ObjectScript</strong> Special Variables$ETRAP Value is a Line of <strong>ObjectScript</strong> CodeBecause the string value of $ETRAP is executable <strong>Caché</strong> <strong>ObjectScript</strong> commands, the lengthof the string cannot be longer than the maximum length of a <strong>Caché</strong> <strong>ObjectScript</strong> routine line.See Using <strong>Caché</strong> <strong>ObjectScript</strong> for more information.$ETRAP and Error HandlingThe $ETRAP special variable is one of many <strong>Caché</strong> <strong>ObjectScript</strong> language features thatenable you to control the handling and logging of errors that occur in your applications.$ETRAP in particular plays an important role in controlling the flow of execution after anerror occurs. See Error Handling in Using <strong>Caché</strong> <strong>ObjectScript</strong> for more information abouterror handling.When setting $ETRAP to execute an error handler (for example, with a GOTO command)you can specify the error handler as tag (a label in the current routine), ^routine (the beginningof a specified external routine), or tag^routine (a specified label in a specified external routine).$ETRAP supports tag+offset in some contexts (but not in procedures). This optional +offsetis an integer specifying the number of lines to offset from tag. <strong>InterSystems</strong> recommendsthat you avoid the use of a line offset when specifying an error handler location.When you set an error handler using $ZTRAP, this handler takes precedence over anyexisting $ETRAP error handler. <strong>Caché</strong> implicitly performs a NEW $ETRAP command andsets $ETRAP to the null string ("").See Also• NEW command• SET command• $ECODE special variable• $ZEOF special variable• $ZTRAP special variable• Error Handling in Using <strong>Caché</strong> <strong>ObjectScript</strong>428 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!