[R-pkg-devel] http error handling in packages

obrl soil obr|@o||@u @end|ng |rom gm@||@com
Wed Sep 8 02:02:51 CEST 2021


Hello list,

my package 'slga' has been flagged for potential removal from CRAN
because of the following:

> Please see the problems shown on
> <https://cran.r-project.org/web/checks/check_results_slga.html>.

> Please correct before 2021-09-19 to safely retain your package on CRAN.

> It seems we need to remind you of the CRAN policy:

> 'Packages which use Internet resources should fail gracefully with an informative message
> if the resource is not available or has changed (and not give a check warning nor error).'

> This needs correction whether or not the resource recovers.

The issue is that the WCS server from which the package retrieves data
sometimes gets overloaded, and throws a 502 error. I currently use a
stop(message)) to return the http error code to the user, e.g. here -
https://github.com/obrl-soil/slga/blob/a770dac9f101995db92e2d42476af8705971d80c/R/get_data.R#L61

I just want to clarify whether the problem is an overly brief error
message, or my use of stop() in this context? What is the preferred
pattern for handling these kinds of errors?

Many thanks,
Lauren O'Brien



More information about the R-package-devel mailing list