[R] How deep into function calls does trycatch() work
Roy Mendelssohn - NOAA Federal
roy@mendel@@ohn @ending from no@@@gov
Thu Aug 16 22:01:13 CEST 2018
Hi All:
I am using another package in a project I have. Because of that, I have no control on how that package behaves or what it returns. This package has a function foo() that calls httr::GET(), and if it gets an error from httr::GET() it calls the following routine:
err_handle2 <- function(x) {
if (x$status_code > 201) {
tt <- content(x, "text")
mssg <- xml_text(xml_find_all(read_html(tt), "//h1"))
stop(paste0(mssg, collapse = "\n\n"), call. = FALSE)
}
}
My question is if I embed my call to foo() in try...catch will that override the stop() call or am I a goner, or is there another way to override it, given that I can't change the code to err_handle2().
Thanks,
-Roy
**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn using noaa.gov www: http://www.pfeg.noaa.gov/
"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
More information about the R-help
mailing list