-
Notifications
You must be signed in to change notification settings - Fork 27
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
Make sure GitHub date-request errors are raised #658
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, let's bump either minor or patch version number, and otherwise lgtm
}, | ||
error = function(e) cat(sprintf("%i. %s\n", i, e$message)) | ||
) | ||
forecaster_dates[[i]] <- lubridate::as_date(get_covidhub_forecast_dates(forecasters[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly out of scope, but if you know off the top of your head, im curious: why are we using lubridate here instead of just as_date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. (All the other as_date
s should really be loading directly from lubridate
since we're not importing the function.)
Thoughts on adding a retry to get_forecast_dates in case it fails due to some HTTP hiccup? |
@dshemetov I added a retry step. This should be ready so please re-review/merge when you have a chance. |
Use
httr::stop_for_status
to error on any non-successful, non-403 (for which we have special handling) status. Remove thetryCatch
wrapper so that the errors actually cause the call to exit.I'm not sure what errors the
tryCatch
was originally intended to catch, but there are a couple reasons to remove it. First, without valid dates, downstream calls won't get valid forecast data. And fetching forecast dates is relatively fast. It isn't a big problem to rerun. It also tests GitHub API authentication, which is necessary for time-consuming forecast downloads later.