From c4b206d7c63c14f1ee286970f2be1c1fe8df0466 Mon Sep 17 00:00:00 2001 From: Vedha Viyash <49812166+vedhav@users.noreply.github.com> Date: Wed, 24 Jan 2024 21:44:39 +0530 Subject: [PATCH] Amend error message when `teal_data` is empty (#1067) Closes #1042 --------- Signed-off-by: Vedha Viyash <49812166+vedhav@users.noreply.github.com> --- R/init.R | 2 +- tests/testthat/test-init.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/init.R b/R/init.R index 5cc44fbbf8..530cc1869a 100644 --- a/R/init.R +++ b/R/init.R @@ -209,7 +209,7 @@ init <- function(data, ## `data` - `modules` if (inherits(data, "teal_data")) { if (length(teal_data_datanames(data)) == 0) { - stop("`data` object has no datanames and its environment is empty. Specify `datanames(data)` and try again.") + stop("The environment of `data` is empty.") } # in case of teal_data_module this check is postponed to the srv_teal_with_splash is_modules_ok <- check_modules_datanames(modules, teal_data_datanames(data)) diff --git a/tests/testthat/test-init.R b/tests/testthat/test-init.R index efa8dea805..5862bf15ca 100644 --- a/tests/testthat/test-init.R +++ b/tests/testthat/test-init.R @@ -49,10 +49,10 @@ testthat::test_that("init filter accepts `teal_slices`", { }) # data + modules ---- -testthat::test_that("init throws when data has no datanames", { +testthat::test_that("init throws when an empty `data` is used", { testthat::expect_error( init(data = teal_data(), modules = list(example_module())), - "`data` object has no datanames and its environment is empty" + "The environment of `data` is empty." ) })