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

Improve error message when internet off or endpoint unreachable #52

Closed
frankfarach opened this issue Apr 4, 2022 · 1 comment
Closed
Assignees
Labels
staged Issue is staged for merging

Comments

@frankfarach
Copy link
Collaborator

From ropensci/software-review#505 (comment):

Because this is a recurrent theme for API packages (and CRAN asks them to "fail gracefully" in these cases), I've checked what happens when I turn of the internet and I don't think it is that explicit for the user.

> npi_search(city = "San Francisco")
Requesting records 0-10...
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Could not resolve host: npiregistry.cms.hhs.gov

Maybe there could be a way to display a better error message when internet is off or the website unreachable?
Like check first hand if internet is off and errors explicitly if it is the case.

@frankfarach frankfarach added this to the rOpenSci Review milestone Apr 4, 2022
@frankfarach frankfarach self-assigned this Apr 4, 2022
@frankfarach
Copy link
Collaborator Author

I was able to reproduce the reported issue and fix it. Here is a reprex after fixing it:

npi::npi_search(city = "San Francisco")
#> 10 records requested
#> Requesting records 0-10...
#> Error in `npi_api()` at npi/R/api.R:49:2:
#> ! Unable to access Internet. Check network connection and try again.

frankfarach added a commit that referenced this issue Apr 16, 2022
@frankfarach frankfarach added the staged Issue is staged for merging label Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
staged Issue is staged for merging
Projects
None yet
Development

No branches or pull requests

1 participant