15.3 Signal Handling

The default superclass defines methods for managing error conditions. These methods all throw a signal for a particular error condition.

By implementing one of these methods for a class, you can change the behavior that occurs during one of these error cases, or even ignore the error by providing some behavior.

Function: slot-missing object slot-name operation &optional new-value

Method invoked when an attempt to access a slot in object fails. slot-name is the name of the failed slot, operation is the type of access that was requested, and optional new-value is the value that was desired to be set.

This method is called from slot-value, set-slot-value, and other functions which directly reference slots in EIEIO objects.

The default method signals an error of type invalid-slot-name. See Signals.

You may override this behavior, but it is not expected to return in the current implementation.

This function takes arguments in a different order than in CLOS.

Function: slot-unbound object class slot-name fn

Slot unbound is invoked during an attempt to reference an unbound slot. object is the instance of the object being reference. class is the class of object, and slot-name is the offending slot. This function throws the signal unbound-slot. You can overload this function and return the value to use in place of the unbound value. Argument fn is the function signaling this error. Use slot-boundp to determine if a slot is bound or not.

In clos, the argument list is (class object slot-name), but eieio can only dispatch on the first argument, so the first two are swapped.

Function: cl-no-applicable-method generic &rest args

Called if there are no methods applicable for args in the generic function generic. args are the arguments that were passed to generic.

Implement this for a class to block this signal. The return value becomes the return value of the original method call.

Function: cl-no-primary-method generic &rest args

Called if there are methods applicable for args in the generic function generic but they are all qualified. args are the arguments that were passed to generic.

Implement this for a class to block this signal. The return value becomes the return value of the original method call.

Function: cl-no-next-method generic method &rest args

Called from cl-call-next-method when no additional methods are available. generic is the generic function being called on cl-call-next-method, method is the method where cl-call-next-method was called, and args are the arguments it is called by. This method signals cl-no-next-method by default. Override this method to not throw an error, and its return value becomes the return value of cl-call-next-method.