Skip to content

Commit

Permalink
government shutdown error catching for ncdc fxns #293
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Dec 31, 2018
1 parent d6aa3c5 commit f65d924
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: Client for many 'NOAA' data sources including the 'NCDC' climate
for 'NOAA' sea ice data, the 'NOAA' severe weather inventory, 'NOAA' Historical
Observing 'Metadata' Repository ('HOMR') data, 'NOAA' storm data via 'IBTrACS',
tornado data via the 'NOAA' storm prediction center, and more.
Version: 0.8.0.9100
Version: 0.8.0.9210
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-US
Expand Down
7 changes: 7 additions & 0 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ check_response <- function(x){
warning(z$status, ": ", z$message)
}
} else {
# government shutdown check
if (
grepl("html", x$response_headers$`content-type`) &&
grepl("shutdown", x$parse("UTF-8"))
) {
stop("there's a government shutdown; check back later")
}
stopifnot(x$response_headers$`content-type` == 'application/json;charset=UTF-8')
res <- x$parse("UTF-8")
out <- jsonlite::fromJSON(res, simplifyVector = FALSE)
Expand Down

0 comments on commit f65d924

Please sign in to comment.