exceptionSignaling: Better condition signaling with objects

Description Usage Arguments Details Value Functions

Description

Use the stopWith, warningWith, and messageWith functions as replacements for the base stop, warning, and message functions when signaling with condition-based objects. These re-base the object to the correct "condition" subclass based on how they were signaled, adding either "error", "warning" and "message" (respectively) just before "condition. They then matching this new object with the matchin base R function. This allows handlers to catch signaled objects based on how they were signaled, and to either group simple message based signals in with object signals, or to differentiate them.

Usage

1
2
3
4
5

Arguments

condition

The condition object being signaled with. If the root class (last) is not "condition", the object is resignaled as is.

Details

Normally, when a signal is caught, the handler that process it is based on the class of the signal object. R's familiar signaling functions (stop, warning, and message) create objects that have different classes based on which was used. However, if you pass one of these signaling function an object rather than a simple message, it does not change the class. If you don't catch it, somehow R still knows they are different signals and does the right thing. However if the signal is caught in user code, this information is lost. A handler can not then recall stop, for instance, if it does not, after all, know how to handle a signal (a common problem).

Value

Nothing, called only for their signal generating and processing side effects.

Functions


jefferys/Exception documentation built on May 19, 2019, 3:59 a.m.