Skip to content

Commit

Permalink
col_exists() only fails and never errors for missing column selection
Browse files Browse the repository at this point in the history
  • Loading branch information
yjunechoe committed Oct 23, 2023
1 parent 8ec5486 commit 3461c33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/col_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ col_exists <- function(
}

# Resolve the columns based on the expression
columns <- resolve_columns(x = x, var_expr = columns, preconditions = NULL)
## Only for `col_exists()`: error gracefully if column not found
columns <- tryCatch(
expr = resolve_columns(x = x, var_expr = columns, preconditions = NULL),
error = function(cnd) cnd$i %||% NA_character_
)

if (is_a_table_object(x)) {

Expand Down

0 comments on commit 3461c33

Please sign in to comment.