how to clear the last error?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to clear the last error?

Adrian Dragulescu

Hello,

I would like to clear the last error that I get with geterrmessage().  Not
even rm(list=ls()) clears it.  Can I set it to NULL somehow?

Thank you,
Adrian

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to clear the last error?

Duncan Murdoch
On 2/9/2006 11:11 AM, Adrian Dragulescu wrote:
> Hello,
>
> I would like to clear the last error that I get with geterrmessage().  Not
> even rm(list=ls()) clears it.  Can I set it to NULL somehow?

Not from R, but there is a C-level way to do it in src/main/errors.c.
It's marked as "temporary", but it's been there since R 1.3.x.

The declaration is

void R_SetErrmessage(char *s);

Alternatively, you could just cover up the last error with a new one by
calling stop, e.g.

 > try(stop(""),TRUE)
 > geterrmessage()
[1] "Error in try(stop(\"\"), TRUE) : \n"

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html