mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 23:48:01 -05:00
Compare commits
5 Commits
main
...
chore/shin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83bee8447e | ||
|
|
41e20f79f8 | ||
|
|
081272f584 | ||
|
|
7f127ce0ae | ||
|
|
d3f8479bcd |
@@ -19,6 +19,7 @@ S3method("[[",shinyoutput)
|
||||
S3method("[[<-",reactivevalues)
|
||||
S3method("[[<-",shinyoutput)
|
||||
S3method("names<-",reactivevalues)
|
||||
S3method(as.list,Map)
|
||||
S3method(as.list,reactivevalues)
|
||||
S3method(as.shiny.appobj,character)
|
||||
S3method(as.shiny.appobj,list)
|
||||
@@ -43,6 +44,7 @@ S3method(bindEvent,reactiveExpr)
|
||||
S3method(bindEvent,shiny.render.function)
|
||||
S3method(format,reactiveExpr)
|
||||
S3method(format,reactiveVal)
|
||||
S3method(length,Map)
|
||||
S3method(names,reactivevalues)
|
||||
S3method(print,reactive)
|
||||
S3method(print,reactivevalues)
|
||||
|
||||
2
NEWS.md
2
NEWS.md
@@ -10,6 +10,8 @@
|
||||
|
||||
* Added a new `ExtendedTask` abstraction, for long-running asynchronous tasks that you don't want to block the rest of the app, or even the rest of the session. Designed to be used with new `bslib::input_task_button()` and `bslib::bind_task_button()` functions that help give user feedback and prevent extra button clicks. (#3958)
|
||||
|
||||
* The `shiny.error` will now pass the error condition object to a handler function if the handler takes an `error` argument. (#3987)
|
||||
|
||||
## Bug fixes
|
||||
|
||||
* Notifications are now constrained to the width of the viewport for window widths smaller the default notification panel size. (#3949)
|
||||
|
||||
3
R/map.R
3
R/map.R
@@ -48,9 +48,12 @@ Map <- R6Class(
|
||||
)
|
||||
)
|
||||
|
||||
#' @export
|
||||
as.list.Map <- function(x, ...) {
|
||||
x$values()
|
||||
}
|
||||
|
||||
#' @export
|
||||
length.Map <- function(x) {
|
||||
x$size()
|
||||
}
|
||||
|
||||
@@ -80,7 +80,10 @@ getShinyOption <- function(name, default = NULL) {
|
||||
#' [shinyDeprecated()] for more information.}
|
||||
#' \item{shiny.error (defaults to `NULL`)}{This can be a function which is called when an error
|
||||
#' occurs. For example, `options(shiny.error=recover)` will result a
|
||||
#' the debugger prompt when an error occurs.}
|
||||
#' the debugger prompt when an error occurs. If the function takes an `error`
|
||||
#' argument, it will be called with the error object. For example,
|
||||
#' `options(shiny.error = function(error) { })` will receive the error
|
||||
#' condition object when an error occurs.}
|
||||
#' \item{shiny.fullstacktrace (defaults to `FALSE`)}{Controls whether "pretty" (`FALSE`) or full
|
||||
#' stack traces (`TRUE`) are dumped to the console when errors occur during Shiny app execution.
|
||||
#' Pretty stack traces attempt to only show user-supplied code, but this pruning can't always
|
||||
|
||||
@@ -16,8 +16,7 @@ NULL
|
||||
#'
|
||||
#' @name shiny-package
|
||||
#' @aliases shiny
|
||||
#' @docType package
|
||||
NULL
|
||||
"_PACKAGE"
|
||||
|
||||
createUniqueId <- function(bytes, prefix = "", suffix = "") {
|
||||
withPrivateSeed({
|
||||
|
||||
@@ -488,7 +488,13 @@ shinyCallingHandlers <- function(expr) {
|
||||
return()
|
||||
|
||||
handle <- getOption('shiny.error')
|
||||
if (is.function(handle)) handle()
|
||||
if (is.function(handle)) {
|
||||
if ("error" %in% names(formals(handle))) {
|
||||
handle(error = e)
|
||||
} else {
|
||||
handle()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ memoryCache(
|
||||
\arguments{
|
||||
\item{max_size}{Maximum size of the cache, in bytes. If the cache exceeds
|
||||
this size, cached objects will be removed according to the value of the
|
||||
\code{evict}. Use \code{Inf} for no size limit. The default is 1 gigabyte.}
|
||||
\code{evict}. Use \code{Inf} for no size limit. The default is 512 megabytes.}
|
||||
|
||||
\item{max_age}{Maximum age of files in cache before they are evicted, in
|
||||
seconds. Use \code{Inf} for no age limit.}
|
||||
|
||||
@@ -41,7 +41,7 @@ set to \code{FALSE}), then use \code{\link[ragg:agg_png]{ragg::agg_png()}}.
|
||||
\item If a quartz device is available (i.e., \code{capabilities("aqua")} is
|
||||
\code{TRUE}), then use \code{png(type = "quartz")}.
|
||||
\item If the Cairo package is installed (and the \code{shiny.usecairo} option
|
||||
is not set to \code{FALSE}), then use \code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}}.
|
||||
is not set to \code{FALSE}), then use \code{\link[Cairo:Cairo]{Cairo::CairoPNG()}}.
|
||||
\item Otherwise, use \code{\link[grDevices:png]{grDevices::png()}}. In this case, Linux and Windows
|
||||
may not antialias some point shapes, resulting in poor quality output.
|
||||
}
|
||||
|
||||
@@ -59,7 +59,10 @@ deprecated functions in Shiny will be printed. See
|
||||
\code{\link[=shinyDeprecated]{shinyDeprecated()}} for more information.}
|
||||
\item{shiny.error (defaults to \code{NULL})}{This can be a function which is called when an error
|
||||
occurs. For example, \code{options(shiny.error=recover)} will result a
|
||||
the debugger prompt when an error occurs.}
|
||||
the debugger prompt when an error occurs. If the function takes an \code{error}
|
||||
argument, it will be called with the error object. For example,
|
||||
\code{options(shiny.error = function(error) { })} will receive the error
|
||||
condition object when an error occurs.}
|
||||
\item{shiny.fullstacktrace (defaults to \code{FALSE})}{Controls whether "pretty" (\code{FALSE}) or full
|
||||
stack traces (\code{TRUE}) are dumped to the console when errors occur during Shiny app execution.
|
||||
Pretty stack traces attempt to only show user-supplied code, but this pruning can't always
|
||||
|
||||
@@ -194,6 +194,17 @@ test_that("shiny.error", {
|
||||
expect_null(caught)
|
||||
})
|
||||
|
||||
test_that("shiny.error passes the error condition to the handler", {
|
||||
caught <- NULL
|
||||
op <- options(shiny.error = function(error) { caught <<- error })
|
||||
on.exit(options(op))
|
||||
|
||||
# Regular errors can be handled by shiny.error
|
||||
try(shiny:::shinyCallingHandlers(stop("boom")), silent = TRUE)
|
||||
expect_equal(conditionMessage(caught), "boom")
|
||||
expect_s3_class(caught, "error")
|
||||
})
|
||||
|
||||
test_that("chained silent errors aren't intercepted (tidyverse/dplyr#5552)", {
|
||||
withr::local_options(
|
||||
shiny.error = function() caught <<- TRUE
|
||||
|
||||
Reference in New Issue
Block a user