|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Most kinds of expressions can, under some circumstances, cause an error to be
generated. For example, the expression
x / y will generate the error
y is equal to zero. When an expression generates an
error, the behavior of the server is controlled by setting of the `d'
(debug) bit on the verb containing that expression. If the `d' 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
This error-squelching behavior is very error prone, since it affects all errors, including ones the programmer may not have anticipated. The `d' 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
exceptstatement, both described below, are far better ways of accomplishing the same thing.
If the `d' bit is set, as it usually is, then the error is raised
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
except 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.