Skip to content

Instantly share code, notes, and snippets.

@tanho63
Last active September 5, 2020 12:16
Show Gist options
  • Save tanho63/8b99954904ed489fe2c2875b47d3ead1 to your computer and use it in GitHub Desktop.
Save tanho63/8b99954904ed489fe2c2875b47d3ead1 to your computer and use it in GitHub Desktop.
Applying Adv-R, 1: Shiny Error Modals
observeEvent(input$run_main, {
showModal(modalDialog(title = "Please wait", "Loading Data!"))
df_reactivevalues <- tryCatch(
fn_loaddata(df_reactivevalues),
error = function(e) {
Sys.sleep(2)
showModal(modalDialog(title = "Oh no, we've found an error!", e$message))},
warning = function(e) {
Sys.sleep(2)
showModal(modalDialog(title = "Warning", e$message))}
)
removeModal()
})
@tanho63
Copy link
Author

tanho63 commented Sep 5, 2020

Useful for a) passing descriptive error messages to app users and b) for debugging unexpected problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment