AFAIK a try or tryCatch will intercept the error thrown by stop(). Why not try it and see if it works?
Peter On Thu, Aug 16, 2018 at 1:05 PM Roy Mendelssohn - NOAA Federal via R-help <r-help@r-project.org> wrote: > > 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.mendelss...@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. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.