mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-06 12:44:58 -05:00
errors are now sanitized in the app by default (must use options(shiny.sanitize.errors = FALSE) to override this behavior)
This commit is contained in:
13
R/shiny.R
13
R/shiny.R
@@ -96,6 +96,12 @@ NULL
|
||||
#' an arguably more intuitive arrangement for casual R users, as the name
|
||||
#' of a function appears next to the srcref where it is defined, rather than
|
||||
#' where it is currently being called from.}
|
||||
#' \item{shiny.sanitize.errors}{If \code{TRUE} (the default), then normal
|
||||
#' errors (i.e errors generated by \code{stop}) won't show up in the app; a
|
||||
#' simple generic error message is printed instead (the error and strack trace
|
||||
#' printed to the console remain unchanged). If you want this behavior in
|
||||
#' general, but you DO want a particular error message to get displayed to the
|
||||
#' user, please use \code{stopWithCondition} instead.}
|
||||
#' }
|
||||
#' @name shiny-options
|
||||
NULL
|
||||
@@ -592,6 +598,13 @@ ShinySession <- R6Class(
|
||||
if (isTRUE(getOption("show.error.messages"))) {
|
||||
printError(cond)
|
||||
}
|
||||
if (getOption("shiny.sanitize.errors", TRUE)) {
|
||||
cond$message <- paste("An error has occurred. Check your logs or contact",
|
||||
"the app author for clarification.")
|
||||
} else {
|
||||
cond$message <- paste0("Error in output$", name, ": ",
|
||||
conditionMessage(cond), "\n")
|
||||
}
|
||||
invisible(structure(msg, class = "try-error", condition = cond))
|
||||
},
|
||||
finally = {
|
||||
|
||||
Reference in New Issue
Block a user