Shiny Try Catch
shinyTryCatch.Rd
Catch multiple errors and warnings, and forward them as an alert. If an error occurs, NULL is
returned. If a warning occurs, the result is returned.
Please, add shinyjs::useShinyjs()
to the UI to enable the alerts.
Usage
shinyTryCatch(
expr,
errorTitle = "Modeling failed",
warningTitle = "",
alertStyle = "shinyjs",
inShiny = TRUE
)
Arguments
- expr
expression to be evaluated.
- errorTitle
(character) error message title.
- warningTitle
(character) warning message title.
- alertStyle
(character) Either "shinyjs", or "shinyalert". Specifies how an error or a warning is given out. If "shinyjs" than shinyjs::alert is used; if "shinyalert" than shinyalert::shinyalert is used.
- inShiny
(logical) if FALSE prevents an alert in shiny, but instead a warning will be displayed. Use this when not applied within a Shiny session.