Next: , Previous: handler-bind, Up: Conditions Dictionary



9.2.27 handler-case [Macro]

handler-case expression [[{!error-clause}* | !no-error-clause]] => {result}*

clause ::=!error-clause | !no-error-clause

error-clause ::=(typespec ([var]) {declaration}* {form}*)

no-error-clause ::=(:no-error lambda-list {declaration}* {form}*)

Arguments and Values::

expression—a form.

typespec—a type specifier.

var—a variable name.

lambda-list—an ordinary lambda list.

declaration—a declare expression; not evaluated.

form—a form.

results—In the normal situation, the values returned are those that result from the evaluation of expression; in the exceptional situation when control is transferred to a clause, the value of the last form in that clause is returned.

Description::

handler-case executes expression in a dynamic environment where various handlers are active. Each error-clause specifies how to handle a condition matching the indicated typespec. A no-error-clause allows the specification of a particular action if control returns normally.

If a condition is signaled for which there is an appropriate error-clause during the ex searched s (+ 3 'a)) |> Fooey: The argument to +, A, is not a number. |> [1] Supply a replacement for A. |> [2] Return to Cloe Toplevel. |> Choice: 1 |> Form to evaluate and use: (+ 5 'b) |> Fooey: The argument to +, B, is not a number. |> [1] Supply a replacement for B. |> [2] Supply a replacement for A. |> [3] Return to Cloe Toplevel. |> Choice: 1 |> Form to evaluate and use: 1 => 9

Affected By::

invoke-debugger

Notes::

When evaluating code typed in by the user interactively, it is sometimes useful to have the hook function bind *debugger-hook* to the function that was its second argument so that recursive errors can be handled using the same interactive facility. ./usr/share/doc/gclcvs-doc/gcl/_002abreak_002don_002dsignals_002a.html0000644000000000000000000001177310156447650025051 0ustar rootroot00000000000000 *break-on-signals* - ANSI and GNU Common Lisp Document

Next: , Previous: *debugger-hook*, Up: Conditions Dictionary



9.2.25 *break-on-signals* [Variable]

Value Type::

a type specifier.

Initial Value::

nil.

Description::

When (typep condition *break-on-signals*) returns true, calls to signal, and to other operators such as error that implicitly call signal, enter the debugger prior to signaling the condition.

The continue restart can be used to continue with the normal signaling process when a break occurs process due to *break-on-signals*.

Examples::
      *break-on-signals* =>  NIL
      (ignore-errors (error 'simple-error :format-control "Fooey!"))
     =>  NIL, #<SIMPLE-ERROR 32207172>
     
      (let ((*break-on-signals* 'error))
        (ignore-errors (error 'simple-error :format-control "Fooey!")))
      |>  Break: Fooey!
      |>  BREAK entered because of *BREAK-ON-SIGNALS*.
      |>  To continue, type :CONTINUE followed by an option number:
      |>   1: Continue to signal.
      |>   2: Top level.
      |>  Debug> |>>:CONTINUE 1<<|
      |>  Continue to signal.
     =>  NIL, #<SIMPLE-ERROR 32212257>
     
      (let ((*break-on-signals* 'error))
        (error 'simple-error :format-control "Fooey!"))
      |>  Break: Fooey!
      |>  BREAK entered because of *BREAK-ON-SIGNALS*.