Skip to main content

throw

Discworld driver help

throw

Name

throw() - forces an error to occur in an object

Synopsis

void throw( mixed arg );

Description

Throw can be used to send an arbitrary value to an enclosing catch() statement. If you want to raise a general error message, see error(), as that will behave better if it is not caught. Control is transfered directly to the enclosing catch() statement, and the value of the catch() statement is the value thrown.

Example

   string err;
   int rc;

   err = catch(rc = ob->move(dest));
   if (err) {
        throw("move.c: ob->move(dest): " + err + "\\n");
        return;
   }

See also

catch(), error(), error_handler()