From e1218d31c797401553d1a35c13e9162aa6dde096 Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 13 Sep 2023 08:19:57 -0700 Subject: [PATCH] wrap manifest/generate in try() then display a popup with the error if it fails --- server.R | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/server.R b/server.R index 8150237a..1c6155b0 100644 --- a/server.R +++ b/server.R @@ -575,6 +575,7 @@ shinyServer(function(input, output, session) { .use_annotations <- dcc_config_react()$manifest_use_annotations promises::future_promise({ + try({ switch(dca_schematic_api, rest = manifest_generate( url=.url, @@ -594,14 +595,26 @@ shinyServer(function(input, output, session) { tibble(a="b", c="d") } ) + }, silent = TRUE) }) %...>% manifest_data() }) observeEvent(manifest_data(), { - if (dcc_config_react()$manifest_output_format == "google_sheet") { - shinyjs::show("div_template") - } else shinyjs::show("div_download_data") + if (inherits(manifest_data(), "try-error")) { + nx_report_error("Failed to get manifest", + tagList( + p("There was a problem downloading the manifest."), + p("Try again or contact the DCC for help"), + p("For debugging: ", manifest_data()) + )) + shinyjs::enable("btn_template_select") + updateTabsetPanel(session, "tab_template_select") + } else { + if (dcc_config_react()$manifest_output_format == "google_sheet") { + shinyjs::show("div_template") + } else shinyjs::show("div_download_data") + } dcWaiter("hide") })