1-
21# ' Process API results
32# '
43# ' Function to turn the parsed response document into meaningful data.
@@ -43,7 +42,7 @@ process_response <- function(
4342 rlang :: try_fetch(
4443 fn(doc ),
4544 error = function (cnd ) {
46- cnd $ call <- call(arg )
45+ cnd $ call <- base :: call(arg )
4746 rlang :: abort(" Failed to process API response." , parent = cnd , call = call )
4847 }
4948 )
@@ -62,16 +61,26 @@ as_function <- function(
6261 } else {
6362 allowed <- list_names(envir )
6463 msg <- " Choose from options: {.val {allowed}}, or provide a function."
65- if (length(allowed ) < 1L ) msg <- " Provide a function instead."
66- cli :: cli_abort(c(" {.val {x}} is not an allowed choice for {.arg {arg}}." , " i" = msg ), call = call )
64+ if (length(allowed ) < 1L ) {
65+ msg <- " Provide a function instead."
66+ }
67+ cli :: cli_abort(
68+ c(" {.val {x}} is not an allowed choice for {.arg {arg}}." , " i" = msg ),
69+ call = call
70+ )
6771 }
6872 } else if (rlang :: is_function(x )) {
69- return ( x )
73+ x
7074 } else {
7175 allowed <- list_names(envir )
7276 msg <- " Provide a function or choose from options: {.val {allowed}}."
73- if (length(allowed ) < 1L ) msg <- " Provide a function instead."
74- cli :: cli_abort(c(" {.arg {arg}} must be a function, not {.val {x}}." , " i" = msg ), call = call )
77+ if (length(allowed ) < 1L ) {
78+ msg <- " Provide a function instead."
79+ }
80+ cli :: cli_abort(
81+ c(" {.arg {arg}} must be a function, not {.val {x}}." , " i" = msg ),
82+ call = call
83+ )
7584 }
7685}
7786
@@ -107,4 +116,4 @@ tibble_cnv <- function(df) {
107116 } else {
108117 df
109118 }
110- }
119+ }
0 commit comments