The key C function that powers both
do_addCondHands(). It creates handler object with
mkHandlerEntry() then stores in the handler stack for the current frame. (More precisely it writes to
R_HandlerStack, a global variable that is an alias to
The five R arguments to
calling. These are combined with a
result object (a list of length 4, returned by the exiting handler to
doTryCatch()) to create the handler objects which have five components:
class, accessed with
ENTRY_CLASS(e). A string given a class name; the handler will match all conditions that contain this component in their class vector.
handler, accessed with
ENTRY_HANDLER(e). This is the function called with the condition object. It can also be
R_RestartToken, used as part of the restarts system.
parentenv, accessed with
ENTRY_CALLING_ENVIR(e). This does not appear to be used.
targetenvironment, accessed with
ENTRY_TARGET_ENVIR(e), is only set by
tryCatch(). This is used to find the frame that the handler will return to.
callingflag, accessed with
IS_CALLING_ENTRY(e)determines if this is a calling/in-place handler (
TRUE) or an exiting handler (
There are four ways for a condition to be signalled:
With an interrupt, which triggers
warning(), which calls
vsignalWarning(), which then calls
vwarningcall_dflt(). (This is particularly complicated because warnings are usually cached and only shown after the top level execution completes.)
signalCondition(), which calls
signalCondition()with a default handler that
cat()s the message to