Skip to content

Stack trace reporting #34

@cpsievert

Description

@cpsievert

It seems as though fiery/routr/reqres based apps don't currently have a mechanism for reporting trace stacks (of errors), which makes debugging complex applications difficult. Here's a minimal example of the information reported in a request error (BTW, any idea why the error is being reported twice?):

library(fiery)
library(routr)

app <- Fire$new()

route <- Route$new()
route$add_handler('get', '*', function(request, response, keys, ...) {
  response$type <- 'html'
  response$status <- 200L
  response$body <- '<h1>All your AI are belong to us</h1>'
  1 + "a"
  FALSE
})

router <- RouteStack$new()
router$add_route(route, "main")
app$attach(router)
app$ignite(showcase = TRUE)
Fire started at 127.0.0.1:8080
error: non-numeric argument to binary operator
error: non-numeric argument to binary operator

With shiny, if you run an app that is saved to disk, it reports the line at which the error occurs -- would it be possible to add something similar to the fiery/routr/reqres stack?

library(shiny)

ui <- fluidPage(
  plotOutput("p")
)

server <- function(input, output, ...) {
  
  output$p <- renderPlot({
    1+"a"
    qplot(1:10)
  })
  
}

shinyApp(ui, server)
runApp('test-app-shiny.R')
Listening on http://127.0.0.1:5017
Warning: Error in +: non-numeric argument to binary operator
  161: renderPlot [~/test-app-shiny.R#10]
  159: func
  119: drawPlot
  105: <reactive:plotObj>
   92: drawReactive
   79: origRenderFunc
   78: output$p
    1: runApp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions