[Rd] Re: [R] No traceback available when using try(...) (PR#6669)
dmurdoch at pair.com
dmurdoch at pair.com
Fri Mar 12 21:39:28 MET 2004
On Fri, 12 Mar 2004 11:44:14 -0500, "Roger D. Peng" <rpeng at jhsph.edu>
wrote :
>Funny, it works for me on R-patched
>
> > f <- function(a) { return(log(a)) }
> > f("A")
>Error in log(x) : Non-numeric argument to mathematical function
> > traceback()
>2: log(a)
>1: f("A")
> > try(f("A"))
>Error in log(x) : Non-numeric argument to mathematical function
> > traceback()
>2: log(a)
>1: f("A")
Oops, I get the same behaviour as you now. I think I must have edited
the transcript before and changed the order of the lines: now I get
the "no traceback" message only if the try(f("A")) comes first. And
notice this infelicity:
> f("A")
Error in log(x) : Non-numeric argument to mathematical function
> traceback()
2: log(a)
1: f("A")
> try(f("B"))
Error in log(x) : Non-numeric argument to mathematical function
> traceback()
2: log(a)
1: f("A") # The wrong traceback!
Presumably what is happening is that the second error leaves the old
traceback in place in both situations. I don't think it should do
that. Luke says the trace is unavailable by the time the try()
returns; could the old one be cleared at the time of the error, to
avoid giving misleading information?
Duncan Murdoch
More information about the R-devel
mailing list