mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 07:28:01 -05:00
Errors in ui function should get stack traces
This commit is contained in:
11
R/shinyui.R
11
R/shinyui.R
@@ -116,10 +116,13 @@ uiHttpHandler <- function(ui, uiPattern = "^/$") {
|
||||
showcaseMode <- mode
|
||||
}
|
||||
uiValue <- if (is.function(ui)) {
|
||||
if (length(formals(ui)) > 0)
|
||||
ui(req)
|
||||
else
|
||||
ui()
|
||||
if (length(formals(ui)) > 0) {
|
||||
# No corresponding ..stacktraceoff.., this is pure user code
|
||||
..stacktraceon..(ui(req))
|
||||
} else {
|
||||
# No corresponding ..stacktraceoff.., this is pure user code
|
||||
..stacktraceon..(ui())
|
||||
}
|
||||
} else {
|
||||
ui
|
||||
}
|
||||
|
||||
11
smoketests/stacktrace3/R.out.save
Normal file
11
smoketests/stacktrace3/R.out.save
Normal file
@@ -0,0 +1,11 @@
|
||||
Loading required package: shiny
|
||||
Loading required package: methods
|
||||
|
||||
Listening on http://127.0.0.1:8765
|
||||
Warning: Error in badfunc: boom
|
||||
Stack trace (innermost first):
|
||||
41: badfunc [${PWD}/stacktrace3/app.R#4]
|
||||
40: server [${PWD}/stacktrace3/app.R#12]
|
||||
1: shiny::runApp [${SHINY}/R/server.R#685]
|
||||
Error in badfunc() : boom
|
||||
NULL
|
||||
15
smoketests/stacktrace3/app.R
Normal file
15
smoketests/stacktrace3/app.R
Normal file
@@ -0,0 +1,15 @@
|
||||
library(shiny)
|
||||
|
||||
badfunc <- function() {
|
||||
stop("boom")
|
||||
}
|
||||
|
||||
ui <- fluidPage(
|
||||
)
|
||||
|
||||
server <- function(input, output, session) {
|
||||
on.exit(stopApp())
|
||||
badfunc()
|
||||
}
|
||||
|
||||
shinyApp(ui, server)
|
||||
11
smoketests/stacktrace4/R.out.save
Normal file
11
smoketests/stacktrace4/R.out.save
Normal file
@@ -0,0 +1,11 @@
|
||||
Loading required package: shiny
|
||||
Loading required package: methods
|
||||
|
||||
Listening on http://127.0.0.1:8765
|
||||
Warning: Error in badfunc: boom
|
||||
Stack trace (innermost first):
|
||||
37: badfunc [${PWD}/stacktrace4/app.R#4]
|
||||
36: ui [${PWD}/stacktrace4/app.R#9]
|
||||
1: shiny::runApp [${SHINY}/R/server.R#685]
|
||||
Error in badfunc() : boom
|
||||
NULL
|
||||
17
smoketests/stacktrace4/app.R
Normal file
17
smoketests/stacktrace4/app.R
Normal file
@@ -0,0 +1,17 @@
|
||||
library(shiny)
|
||||
|
||||
badfunc <- function() {
|
||||
stop("boom")
|
||||
}
|
||||
|
||||
ui <- function(req) {
|
||||
stopApp()
|
||||
badfunc()
|
||||
}
|
||||
|
||||
server <- function(input, output, session) {
|
||||
on.exit(stopApp())
|
||||
badfunc()
|
||||
}
|
||||
|
||||
shinyApp(ui, server)
|
||||
Reference in New Issue
Block a user