From 6570474e6a41c83aa70e530276a4c15f9dd9b733 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Fri, 10 Nov 2023 12:25:48 +0100 Subject: [PATCH] fix error handling when simple error in teal_data_module --- R/module_teal_with_splash.R | 2 +- tests/testthat/test-module_teal_with_splash.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/module_teal_with_splash.R b/R/module_teal_with_splash.R index 062ea3353f..a5dc279a79 100644 --- a/R/module_teal_with_splash.R +++ b/R/module_teal_with_splash.R @@ -143,7 +143,7 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { FALSE, paste0( "Error when executing `teal_data_module`:\n ", - attr(data, "condition")$message, + data$message, "\n Check your inputs or contact app developer if error persists" ) ) diff --git a/tests/testthat/test-module_teal_with_splash.R b/tests/testthat/test-module_teal_with_splash.R index 769f6b3491..53b56098db 100644 --- a/tests/testthat/test-module_teal_with_splash.R +++ b/tests/testthat/test-module_teal_with_splash.R @@ -78,13 +78,13 @@ testthat::test_that("srv_teal_with_splash raw_data_checked throws when teal_data id = "test", data = teal_data_module( ui = function(id) div(), - server = function(id) reactive(stop()) + server = function(id) reactive(stop("this error")) ), modules = modules(example_module()) ), expr = { testthat::expect_is(raw_data_checked, "reactive") - testthat::expect_error(raw_data_checked(), "Error when executing `teal_data_module`") + testthat::expect_error(raw_data_checked(), "this error") } ) })