From karl.forner at gmail.com  Fri Nov 29 11:30:16 2013
From: karl.forner at gmail.com (Karl Forner)
Date: Fri, 29 Nov 2013 11:30:16 +0100
Subject: [Rd] How to catch warnings sent by arguments of s4 methods ?
Message-ID: <CAMd4_AfmWJ7bYS31QH1Gt+==QVXR=E-RQtgV8MsUUQ_iwsf9rw@mail.gmail.com>

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



[Rd] How to catch warnings sent by arguments of s4 methods ?
Karl Forner