Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions should fail gracefully with an informative message if the resource is not available #358

Closed
stitam opened this issue Jun 5, 2022 · 3 comments
Assignees

Comments

@stitam
Copy link
Contributor

stitam commented Jun 5, 2022

CRAN Team requested to review our compliance with this policy. My current understanding on their issue is that ping() error should not produce a query function error so stop() should be removed from all of these functions. They asked us to correct this before 2022-06-11.

@stitam stitam self-assigned this Jun 5, 2022
@Aariq
Copy link
Collaborator

Aariq commented Jun 6, 2022

I think from the wording they only care about "failing gracefully" for tests, examples, and vignettes—otherwise automated tests and stuff don't work. It doesn't sound like they explicitly have a problem with a function erroring for a user when the API is down.

But honestly, I don't know anywhere where we aren't meeting this guideline. Vignette is pre-compiled, all the examples are wrapped in donttest{} (I think?) and the tests all get skipped when the API is down.

@stitam
Copy link
Contributor Author

stitam commented Jun 6, 2022

I think I found a clue. Sometimes we use donttest{} and sometimes we use dontrun{}. Apparently there is a difference: https://stackoverflow.com/questions/68935126/when-and-when-not-to-use-donttest-and-dontrun-in-r-package-development.

The cir_img() example was wrapped in donttest. When they ran the example, this line produced an error because the API was down: if (!ping_service("cir")) stop(webchem_message("service_down")). However, since this was wrapped in donttest, this should have exited without any error.

I think having dontrun everywhere is the way to go, what do you think?

@Aariq
Copy link
Collaborator

Aariq commented Jun 6, 2022

I think having dontrun everywhere is the way to go, what do you think?

Sounds like the right solution to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants