From mtmorgan at fhcrc.org  Mon Feb  6 18:02:34 2012
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Mon, 06 Feb 2012 09:02:34 -0800
Subject: [Rd] Resume processing after warning handler.
In-Reply-To: <CAM+LvrCCFXHNe6XHB_2m6xKPc_hXi6NYj+kUehqAGL_VC1mQfQ@mail.gmail.com>
References: <CAM+LvrB21RWJJ2UcO6xaNbb5X9xUJXju04pwEJCwAt79qjdUtQ@mail.gmail.com>
	<4F2D50AF.2050801@fhcrc.org>
	<CAM+LvrCCFXHNe6XHB_2m6xKPc_hXi6NYj+kUehqAGL_VC1mQfQ@mail.gmail.com>
Message-ID: <4F3007AA.8020105@fhcrc.org>

On 02/06/2012 04:46 AM, Titus von der Malsburg wrote:
> On Sat, Feb 4, 2012 at 4:37 PM, Martin Morgan<mtmorgan at fhcrc.org>  wrote:
>> On 02/03/2012 02:49 AM, Titus von der Malsburg wrote:
>> Hi Titus -- use withCallingHandlers to capture the warning, and
>> invokeRestart() to continue after handling it.
>>
>> withCallingHandlers({
>>     warning('oops')
>>     message('continuing')
>> }, warning=function(w) {
>>     message('handling: ', conditionMessage(w))
>>     invokeRestart("muffleWarning")
>> })
>
>
> Thanks Martin!  This is exactly what I was looking for.  I saw the
> invocation of muffledWarning in a few places when I googled warning
> and error handlers but unfortunately I couldn't find explanations and
> documentation about it.  When I invoked muffledWarning in a warning
> handler for tryCatch, I got a message saying that there's no restart
> named like that.  MuffledWarning is not mentioned in the man page of
> withCallingHandlers.  Also, figuring out basic stuff like that you can
> add warning and error arguments to tryCatch was also not so easy.  Is
> there a document somewhere that explains handling of errors and
> warnings in detail?

Hi Titus

I don't have a particular resource for you; others on the list might, 
and google turned up some useful hits. "muffleWarning" is mentioned on 
?warning, but in truth I first spotted it when looking at the source for 
warning.

Martin

>
>    Titus


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



[Rd] Resume processing after warning handler.
Martin Morgan