Skip to content
Prev 38945 / 63424 Next

Regression in error handling with R >= 2.12

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.