[Rd] How to catch warnings sent by arguments of s4 methods ?
Karl Forner
karl.forner at gmail.com
Fri Nov 29 11:30:16 CET 2013
Hello,
I apologized if this had already been addressed, and I also submitted
this problem on SO:
http://stackoverflow.com/questions/20268021/how-to-catch-warnings-sent-during-s4-method-selection
Example code:
setGeneric('my_method', function(x) standardGeneric('my_method') )
setMethod('my_method', 'ANY', function(x) invisible())
withCallingHandlers(my_method(warning('argh')), warning = function(w)
{ stop('got warning:', w) })
# this does not catch the warning
It seems that the warnings emitted during the evaluation of the
arguments of S4 methods can not get caught using
withCallingHandlers().
Is this expected ? Is there a work-around ?
Best,
Karl Forner
More information about the R-devel
mailing list