User Tools


Function SIGNAL

Syntax

  • signal datum &rest argumentsnil

Arguments and Values

Description

Signals the condition denoted by the given datum and arguments. If the condition is not handled, signal returns nil.

Examples

(defun handle-division-conditions (condition) (format t "Considering condition for division condition handling~%" (when (and (typep condition 'arithmetic-error) (eq '/ (arithmetic-error-operation condition))) (invoke-debugger condition)))

HANDLE-DIVISION-CONDITION

(defun handle-other-arithmetic-errors (condition) (format t "Considering condition for arithmetic condition handling~%" (when (typep condition 'arithmetic-error) (abort)))

HANDLE-OTHER-ARITHMETIC-ERRORS

(define-condition a-condition-with-no-handler (condition) ())

A-CONDITION-WITH-NO-HANDLER

(signal 'a-condition-with-no-handler)

NIL

(handler-bind ((condition #'handle-division-conditions) (condition #'handle-other-arithmetic-errors)) (signal 'a-condition-with-no-handler))

Considering condition for division condition handling Considering condition for arithmetic condition handling

NIL

(handler-bind ((arithmetic-error #'handle-division-conditions) (arithmetic-error #'handle-other-arithmetic-errors)) (signal 'arithmetic-error :operation '* :operands '(1.2 b)))

Considering condition for division condition handling Considering condition for arithmetic condition handling

NIL

Side Effects

The debugger might be entered due to *break-on-signals*.

Handlers for the condition being signaled might transfer control.

Affected By

Existing handler bindings.

*break-on-signals*

Exceptional Situations

None.

See Also

Notes

If (typep datum *break-on-signals*) yields true, the debugger is entered prior to beginning the signaling process. the continue restart can be used to continue with the signaling process. This is also true for all other functions and macros that should, might, or must signal conditions.