error

Gamma: Version 4.0
Prev |  | Next

# `error`

`error` -- redirects the interpreter.

## Syntax

    error (string)

## Arguments

`string`

  A string.

## Returns

This function does not return.

## Description

The `error` function causes the interpreter to immediately stop what it is doing and to jump to the innermost `trap_error`, `unwind_protect`, interactive session or interprocess communication event handler. The value of `_last_error_` is set to the argument string.

## Example

This function will return its argument if the argument is a number, or generate an error and never return if the argument is not a number.

        function check_number (n)
        {
            if (!number_p(n))
        	{
                   error(string(n," is not a number."));
        	}
            n;
        }

This statement will immediately cause an error if the user presses `Ctrl-C` at the keyboard. This is useful for breaking a running program and going to a debugging prompt.

        signal (SIGINT, #(error ("Keyboard Interrupt")))

## See Also

`trap_error`, `unwind_protect`

Prev | Home | Next
`eq`, `equal` | Up | `eval`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.