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

Could git_sitrep() check for network (proxy) connection? #725

ijlyttle opened this issue Apr 20, 2019 · 1 comment

Could git_sitrep() check for network (proxy) connection? #725

ijlyttle opened this issue Apr 20, 2019 · 1 comment


Copy link

@ijlyttle ijlyttle commented Apr 20, 2019

This was the "edgiest" of cases, but I thought it was interesting.

Someone at the workshop used a proxy but did not have their environment variables set up for the proxy. I think that proxy-setup is clearly beyond the scope of usethis, but it did seem that from the git_sitrep() perspective, a network failure is indistinguishable from an invalid token.

With my network off:

#> Git user
#> * Name: 'Ian Lyttle'
#> * Email: ''
#> * Vaccinated: TRUE
#> usethis + git2r
#> * Default usethis protocol: <unset>
#> * git2r supports SSH: TRUE
#> * Credentials: '<usethis + git2r default behaviour>'
#> GitHub
#> * Personal access token: '<found in env var>'
#> ✖ Token is invalid.
#> Repo
#> ℹ No active usethis project.

Created on 2019-04-20 by the reprex package (v0.2.1)

As a first idea, could git_sitrep() look for a successful call to something like httr::GET("") to determine if it has network access?

Copy link

@hadley hadley commented Apr 21, 2019

I think a slightly better approach would be to use a more targeted tryCatch():

  http_error_401 = function(e) "bad token",
  error = function(e) "bad connection"

@jennybc jennybc closed this in #727 Jul 3, 2019
jennybc added a commit that referenced this issue Jul 3, 2019
…ror (#727)

* Issue different feedback depending on the error

* Add NEWS item

* Make code tidier

* Reword message

* Rephrase

* Leave a TODO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants