[Rd] Regression in error handling with R >= 2.12

Hervé Pagès hpages at fhcrc.org
Tue Jan 25 19:13:11 CET 2011


Hi list,

When nesting 2 function calls, if an exception occurs during the inner 
call, the error message will display properly:

   bar <- function() stop("bar() is broken")
   foo <- function(x) {x * (x - 2)}

   > foo(bar())
   Error in bar() : bar() is broken

However, starting with R 2.12, if foo() is a generic function, we only
get the following not-so-informative message:

   setMethod("foo", "numeric", function(x) {x * (x - 2)})

   > foo(bar())
   Error in foo(bar()) :
     error in evaluating the argument 'x' in selecting a method for 
function 'foo'

With versions prior to R 2.12, we were getting the full story:

   > foo(bar())
   Error in bar() : bar() is broken
   Error in foo(bar()) :
     error in evaluating the argument 'x' in selecting a method for 
function 'foo'

Could this behavior be restored?

Thanks,
H.

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the R-devel mailing list