is it possible to throw a stop() that is so hard that it will escape even tryCatch? /iaw ---- Ivo Welch (ivo.welch at gmail.com)
stop() does not have momentum... it is designed to play nice.
Perhaps you want ?options(error=).
Alternately, you want to trigger a core dump?
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
ivo welch <ivo.welch at anderson.ucla.edu> wrote:
>is it possible to throw a stop() that is so hard that it will escape
>even tryCatch?
>
>/iaw
>----
>Ivo Welch (ivo.welch at gmail.com)
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
See abort() in the R.oo package, with some discussion here https://stat.ethz.ch/pipermail/r-devel/2012-September/064838.html /Henrik On Wed, Feb 6, 2013 at 7:05 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> stop() does not have momentum... it is designed to play nice. > > Perhaps you want ?options(error=). > Alternately, you want to trigger a core dump? > --------------------------------------------------------------------------- > Jeff Newmiller The ..... ..... Go Live... > DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/Batteries O.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --------------------------------------------------------------------------- > Sent from my phone. Please excuse my brevity. > > ivo welch <ivo.welch at anderson.ucla.edu> wrote: > >>is it possible to throw a stop() that is so hard that it will escape >>even tryCatch? >> >>/iaw >>---- >>Ivo Welch (ivo.welch at gmail.com) >> >>______________________________________________ >>R-help at r-project.org mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide >>http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
q()?
E.g.,
> f <- function(x) { switch(sign(x)+2, q(), stop("Oops"),
NULL) ; sqrt(x) }
> tryCatch(f(2), error=function(e)"error")
[1] 1.414214
> tryCatch(f(0), error=function(e)"error")
[1] "error"
> tryCatch(f(-2), error=function(e)"error")
Save workspace image? [y/n/c]: c
> for(i in 1:3)tryCatch(f(-2), error=function(e)"error")
Save workspace image? [y/n/c]: c
>
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at
r-project.org] On Behalf
> Of ivo welch
> Sent: Wednesday, February 06, 2013 5:33 PM
> To: r-help
> Subject: [R] Hard Stop?
>
> is it possible to throw a stop() that is so hard that it will escape
> even tryCatch?
>
> /iaw
> ----
> Ivo Welch (ivo.welch at gmail.com)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
On 06/02/2013 8:33 PM, ivo welch wrote:> is it possible to throw a stop() that is so hard that it will escape > even tryCatch?You can signal a condition that is not an error, and if tryCatch hasn't been written to catch it, it will stop. For example, g <- function() { tryCatch(f(), error=function(e) NULL cat("Still running\n") } f <- function() stop("Regular error") # This won't stop g() g() f <- function() stop(simpleCondition("I mean it!")) # This will g() Of course, you can catch simpleConditions too if you try. Duncan Murdoch