Skip to main content

invalid-method-error

invalid-method-error Function

Syntax:

invalid-method-error method format-control &rest args → implementation-dependent

Arguments and Values:

method—a method.

format-control—a format control.

argsformat arguments for the format-control.

Description:

The function invalid-method-error is used to signal an error of type error when there is an applicable method whose qualifiers are not valid for the method combination type. The error message is constructed by using the format-control suitable for format and any args to it. Because an implementation may need to add additional contextual information to the error message, invalid-method-error should be called only within the dynamic extent of a method combination function.

The function invalid-method-error is called automatically when a method fails to satisfy every qualifier pattern and predicate in a define-method-combination form. A method combination function that imposes additional restrictions should call invalid-method-error explicitly if it encounters a method it cannot accept.

Whether invalid-method-error returns to its caller or exits via throw is implementation-dependent.

Side Effects:

The debugger might be entered.

Affected By:

*break-on-signals*

See Also:

define-method-combination

Expanded Reference: invalid-method-error

Purpose

invalid-method-error is called to signal an error when a method does not conform to the qualifiers required by the method combination. It is intended to be called from the body of effective method computations in user-defined method combinations.

Signature

(invalid-method-error method format-control &rest format-arguments)

The first argument is the offending method object. The remaining arguments form a format control string and arguments describing the error.

Typical Usage in define-method-combination

invalid-method-error is typically called from within define-method-combination when a method has unexpected qualifiers.

;; Conceptual example (within a define-method-combination body):
;; (when (some-invalid-qualifier-p method)
;; (invalid-method-error method
;; "~S has an invalid qualifier for this combination." method))

Not Commonly Called Directly

Most application code does not call invalid-method-error directly. It is part of the protocol for defining custom method combinations. The CLOS implementation calls it when needed during method dispatch.