Skip to content

Commit

Permalink
handle errors with better messages
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconazzaro committed Mar 8, 2021
1 parent f2fd356 commit 4ff48b3
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import traceback

import streamlit as st

Expand All @@ -11,8 +12,15 @@


st.set_page_config(layout='wide', initial_sidebar_state='collapsed')
repo_reference = import_data.RepoReference()
DATA, DATA_TI, DATA_RIC = import_data.covid19(repo_reference)
try:
repo_reference = import_data.RepoReference()
DATA, DATA_TI, DATA_RIC = import_data.covid19(repo_reference)
except:
st.error(
"L'applicazione è in fase di aggiornamento. Prova a [riaggiornare](/) la pagina tra qualche secondo.")
error = st.beta_expander("Dettagli dell'errore")
error.error(traceback.format_exc())
st.stop()

fmt = "%d-%m-%Y"

Expand Down Expand Up @@ -213,12 +221,18 @@ def explore_regions(country):

st.title('COVID-19: Situazione in Italia')
st.text("")
vaccine_repo = import_data.RepoReference(
repo_path='covid19-opendata-vaccini',
repo_url='https://github.com/italia/covid19-opendata-vaccini.git'
)
vaccines = import_data.vaccines(vaccine_repo, DATA)
demography = import_data.demography(vaccines)
try:
vaccine_repo = import_data.RepoReference(
repo_path='covid19-opendata-vaccini',
repo_url='https://github.com/italia/covid19-opendata-vaccini.git'
)
vaccines = import_data.vaccines(vaccine_repo, DATA)
demography = import_data.demography(vaccines)
except:
st.error("L'applicazione è in fase di aggiornamento. Prova a [riaggiornare](/) la pagina tra qualche secondo.")
error = st.beta_expander("Dettagli dell'errore")
error.error(traceback.format_exc())
st.stop()

default_what_map = {'infection': 0, 'vaccines': 1, 'contagio': 0, 'vaccini': 1}

Expand Down

0 comments on commit 4ff48b3

Please sign in to comment.