Skip to content

Commit

Permalink
Merge ca65741 into 03d6bb4
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhoey committed Jun 16, 2020
2 parents 03d6bb4 + ca65741 commit 2b59125
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions R/call_waterinfo.R
Expand Up @@ -70,14 +70,16 @@ call_waterinfo <- function(query, base_url = "vmm", token = NULL) {
regexpr(pattern, custom_error,
perl = TRUE
))
}
if (grep(pattern = "Credit limit exceeded", error_message) == 1) {
error_message <- paste(error_message,
"- When you require more extended data requests, please request",
"a download token from the waterinfo.be site administrators via",
"the e-mail address hydrometrie@waterinfo.be with a statement of",
"which data and how frequently you would like to download data.",
"Run `?wateRinfo::token` for more information on token usage.")
if (isTRUE(grep(pattern = "Credit limit exceeded", error_message))) {
error_message <- paste(error_message,
"- When you require more extended data requests, please request ",
"a download token from the waterinfo.be site administrators via ",
"the e-mail address hydrometrie@waterinfo.be with a statement of ",
"which data and how frequently you would like to download data. ",
"Run `?wateRinfo::token` for more information on token usage.")
}
} else {
error_message <- "API returned response type not known to wateRinfo package (no json or XML)."
}
stop("API did not return json - ", trimws(error_message), call. = FALSE)
}
Expand Down

0 comments on commit 2b59125

Please sign in to comment.