s-news
[Top] [All Lists]

Summary: Trapping loess errors in a loop

To: s-news@wubios.wustl.edu
Subject: Summary: Trapping loess errors in a loop
From: Madeline Bauer <mbauer@usc.edu>
Date: Wed, 03 Jun 2009 12:45:18 -0700
Cc: William Dunlap <wdunlap@tibco.com>
In-reply-to: <77EB52C6DD32BA4D87471DCD70C8D7000147B4A7@NA-PA-VBE03.na.ti bco.com>
References: <7j13io$32c4um@msg-ironport2.usc.edu> <7k97ho$3p6mcr@msg-ironport0.usc.edu> <77EB52C6DD32BA4D87471DCD70C8D7000147B4A7@NA-PA-VBE03.na.tibco.com>
Using try, my function returns an object (say my.model) regardless of error. class(my.model) reports "loess" or "Error" so I can take the needed actions.

Again thanks to Samer Mouksassi who suggested using try (loess (... )) and Steve Wofsy who suggested on.error.

And a big Thank You to Bill Dunlap for the following explanation of on.exit, on.error and try. Now I can stop feeling guilty about not trying to figure out how to use on.error.

on.exit or on.error would not be helpful here.  They
allow you to evaluate an _expression_ when the main
function runs into an error, but they don't allow you
to stop the normal error processing -- the main function
will not return a value to its caller.  try(), via its call to
restart(), stops the normal error processing and lets
the function return a value.  (Calling restart() directly
is tricky and often leads to infinite loops, but try()
avoids the pitfalls.)

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com

===
Madeline Bauer, Ph.D.        University of Southern California
Keck School of Medicine (Infectious Diseases)
IRD Room 620 (MC9520), 2020 Zonal Ave, Los Angeles 90033
(323) 226-2775 [Voice] (FAX by appointment ;-)
mbauer@usc.edu  [Fastest communication method]


<Prev in Thread] Current Thread [Next in Thread>
  • Summary: Trapping loess errors in a loop, Madeline Bauer <=