Skip to content
Back to formatted view

Raw Message

Message-ID: <4D3F12B7.9060809@fhcrc.org>
Date: 2011-01-25T18:13:11Z
From: Hervé Pagès
Subject: 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.

-- 
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