eieio: Signal Handling
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 ‘oref’, ‘oset’, and other functions
which directly reference slots in EIEIO objects.
The default method signals an error of type ‘invalid-slot-name’.
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: no-applicable-method object method &rest args
Called if there are no implementations for OBJECT in METHOD.
OBJECT is the object which has no method implementation. ARGS are
the arguments that were passed to METHOD.
Implement this for a class to block this signal. The return value
becomes the return value of the original method call.
-- Function: no-next-method object &rest args
Called from “call-next-method” when no additional methods are
available. OBJECT is othe object being called on
“call-next-method”. ARGS are the arguments it is called by. This
method signals “no-next-method” by default. Override this method
to not throw an error, and its return value becomes the return
value of “call-next-method”.