@@ -255,26 +255,30 @@ NULL
255255# '
256256# ' @export
257257apply_to_each <- function (.cstr , ... , .args = list ()) {
258+ call <- sys.call()
258259 check_arg_type(.cstr , " function" )
259260 check_arg_type(.args , " list" )
260261 col_specs <- rlang :: enquos(... )
261- constraint_specs <- purrr :: map(col_specs , \(spec )
262- rlang :: eval_tidy(rlang :: expr(
263- (.cstr )(!! spec , !!! .args )
262+ constraint_specs <- purrr :: map(col_specs , \(col_spec ) {
263+ cstr_spec <- rlang :: eval_tidy(rlang :: expr(
264+ (.cstr )(!! col_spec , !!! .args )
264265 ))
265- )
266+ environment(cstr_spec )$ call <- call
267+ cstr_spec
268+ })
266269 as_qf_constraint_list(constraint_specs )
267270}
268271
269272# ' @rdname apply_to_each
270273# ' @export
271274apply_to_each_col <- function (.cstr , .cols , .args = list ()) {
275+ call <- sys.call()
272276 check_arg_type(.cstr , " function" )
273277 check_arg_type(.args , " list" )
274278 col_specs <- rlang :: enquo(.cols )
275279
276280 new_qf_constraint_specifier({
277- cols <- select_names(col_specs , .table )
281+ cols <- select_names(col_specs , .table , error_call = call )
278282 constraint_objs <- purrr :: map(cols , \(col ) {
279283 f <- do.call(.cstr , c(list (col ), .args ))
280284 (f )(.table )
0 commit comments