Reactive R6Class that returns HTML according to a test function. Modules like
checked_text_input
or observed_vector_input
provide an argument accepting an ErrorController or ErrorControllerList
that expands the module's default tests.
1 2 3 4 5 6 | error_controller <- shiny::isolate({ErrorController$new(
fun = function(x) purrr::is_null(x),
ui_true = "x is NULL",
ui_false = "x is not NULL",
error = TRUE
)})
|
new(fun, ui_true = NULL, ui_false = NULL, priority = 0, error = NULL)
Initialize the error controller.
fun | Function with exactly one
argument returning TRUE or
FALSE . |
ui_true | HTML-like tag to be
returned by this$get_ui() , if this$fun(this$value) == TRUE . |
ui_false | HTML-like tag to be
returned by this$get_ui() , if this$fun(this$value) == FALSE . |
priority | Numeric which is used
by ErrorControllerList to determine the order in which
to display the UIs of their error controllers. |
error | Determine which result of this$fun(this$value) shall
be counted as an error or use NULL if either
result produces no error, which is useful for displaying warnings or
help messages based on user input.
|
get_priority()
Get the error controller's priority.
get_ui()
Get the error controller's ui.
has_error()
Get a logical
indicating
whether this$fun(this$value) equals this$error. If error = NULL
in this$new(), this method always returns false.
set_priority(priority)
Set the priority of the error controller.
set_value
Set the value which is checked by this$fun().
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.