Hello,
Does anyone know if it is possible to find out whether a calling function 
exited with an error or not inside of an on.exit() call? I'd like to use the 
same error cleanup function inside of several functions, and for aesthetic 
reasons would prefer not to surround the body of all of these function with a 
tryCatch.

Something like this:

isError <- function() {
        parentError <- ???
        if (!parentError) cat("No errors here!\n")
}

X <- function() {
        on.exit(isError())
        1+1
}

> X()
[1] 2
No errors here!

Thanks,
Robert

Robert McGehee, CFA
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109
Direct: (617)392-8396

This e-mail, and any attachments hereto, are intended fo...{{dropped:10}}

______________________________________________
R-help@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.

Reply via email to