Last active
September 5, 2020 12:16
-
-
Save tanho63/8b99954904ed489fe2c2875b47d3ead1 to your computer and use it in GitHub Desktop.
Applying Adv-R, 1: Shiny Error Modals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful for a) passing descriptive error messages to app users and b) for debugging unexpected problems.