<HEAD> <TITLE> catch - catch an evaluation error </TITLE> </HEAD> <BODY BACKGROUND=http://www.imaginary.com/~beek/gifs/bg.jpg TEXT=#000000 ALINK=#FFFF00 VLINK=#550000 LINK=#000099> <center> <H1> catch - catch an evaluation error </H1> </center> <p> <b> mixed catch( mixed expr ); </b> <p> <b> mixed catch { ... }; </b> <p> Note: catch is really a keyword and not an efun. <p> The code inside the { ... } or the expression is evaluated. If there is no error, catch() returns zero. If there is an error, a string (with a leading '*') will be returned. <p> The function throw() can also be used to immediately return any value, except 0. <p> The catch() is somewhat costly, and should not be used just anywhere. Rather, use it at places where an error would destroy consistency. <p> See also: <A HREF=../system/error.html> error </A>, <A HREF=throw.html> throw </A>, <A HREF=../../applies/master/error_handler.html> error_handler </A> <p> <HR> <ADDRESS> <A HREF=http://wagner.princeton.edu/~tim> Tim Hollebeek </A> <p> <A HREF="http://www.imaginary.com/~beek/"> Beek </A>@ZorkMUD, Lima Bean, IdeaExchange, TMI-2, and elsewhere </ADDRESS>