/
html/
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.51
     from ProgrammersManual.texinfo on 4 March 1997 -->

<TITLE>LambdaMOO Programmer's Manual - Expression Errors</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="ProgrammersManual_1.html">first</A>, <A HREF="ProgrammersManual_10.html">previous</A>, <A HREF="ProgrammersManual_12.html">next</A>, <A HREF="ProgrammersManual_77.html">last</A> section, <A HREF="ProgrammersManual_toc.html">table of contents</A>.
<P><HR><P>


<H3><A NAME="SEC11" HREF="ProgrammersManual_toc.html#TOC11">Errors While Evaluating Expressions</A></H3>

<P>
Most kinds of expressions can, under some circumstances, cause an error to be
generated.  For example, the expression <CODE>x / y</CODE> will generate the error
<CODE>E_DIV</CODE> if <CODE>y</CODE> is equal to zero.  When an expression generates an
error, the behavior of the server is controlled by setting of the <SAMP>`d'</SAMP>
(debug) bit on the verb containing that expression.  If the <SAMP>`d'</SAMP> bit is not
set, then the error is effectively squelched immediately upon generation; the
error value is simply returned as the value of the expression that generated
it.

</P>

<BLOCKQUOTE>
<P>
<STRONG>Note:</STRONG> this error-squelching behavior is very error prone, since it
affects <EM>all</EM> errors, including ones the programmer may not have
anticipated.  The <SAMP>`d'</SAMP> bit exists only for historical reasons; it was once
the only way for MOO programmers to catch and handle errors.  The
error-catching expression and the <CODE>try</CODE>-<CODE>except</CODE> statement, both
described below, are far better ways of accomplishing the same thing.
</BLOCKQUOTE>

<P>
If the <SAMP>`d'</SAMP> bit is set, as it usually is, then the error is <STRONG>raised</STRONG>
and can be caught and handled either by code surrounding the expression in
question or by verbs higher up on the chain of calls leading to the current
verb.  If the error is not caught, then the server aborts the entire task and,
by default, prints a message to the current player.  See the descriptions of
the error-catching expression and the <CODE>try</CODE>-<CODE>except</CODE> statement for
the details of how errors can be caught, and the chapter on server assumptions
about the database for details on the handling of uncaught errors.

</P>
<P><HR><P>
Go to the <A HREF="ProgrammersManual_1.html">first</A>, <A HREF="ProgrammersManual_10.html">previous</A>, <A HREF="ProgrammersManual_12.html">next</A>, <A HREF="ProgrammersManual_77.html">last</A> section, <A HREF="ProgrammersManual_toc.html">table of contents</A>.
</BODY>
</HTML>