Skip to content

Commit

Permalink
nocov for more error conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
wibeasley committed Sep 6, 2022
1 parent 3462649 commit 18ea0fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/redcap-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ redcap_read <- function(

# Stop and return to the caller if the initial query failed. --------------
if (!initial_call$success) {
# nocov start
outcome_messages <- paste0("The initial call failed with the code: ", initial_call$status_code, ".")
elapsed_seconds <- as.numeric(difftime(Sys.time(), start_time, units="secs"))
return(list(
Expand All @@ -317,6 +318,7 @@ redcap_read <- function(
outcome_messages = outcome_messages,
success = initial_call$success
))
# nocov end
}

# Continue as intended if the initial query succeeded. --------------------
Expand Down Expand Up @@ -415,6 +417,7 @@ redcap_read <- function(
ids_missing_rows <- setdiff(unique_ids, unique_ids_actual)

if (0L < length(ids_missing_rows)) {
# nocov start
message_template <-
paste0(
"There are %i subject(s) that are missing rows in the returned dataset. ",
Expand All @@ -433,6 +436,7 @@ redcap_read <- function(
length(ids_missing_rows),
paste(ids_missing_rows, collapse = ",")
))
# nocov end
}

elapsed_seconds <- as.numeric(difftime( Sys.time(), start_time, units="secs"))
Expand Down

0 comments on commit 18ea0fb

Please sign in to comment.