From 7587320d4f7d54a4870a3687ce073ee52a66dd09 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Mon, 23 Sep 2024 22:53:40 +0800 Subject: [PATCH 1/2] (feat) add error handling for dates --- frontend/pages/data/download_candles/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/pages/data/download_candles/app.py b/frontend/pages/data/download_candles/app.py index 5245458..e605084 100644 --- a/frontend/pages/data/download_candles/app.py +++ b/frontend/pages/data/download_candles/app.py @@ -27,6 +27,9 @@ if get_data_button: start_datetime = datetime.combine(start_date, time.min) end_datetime = datetime.combine(end_date, time.max) + if end_datetime < start_datetime: + st.error("End Date should be greater than Start Date.") + st.stop() candles = backend_api_client.get_historical_candles( connector=connector, From 2224bf094cfcc377a92bccb09d5b7cfcac860b20 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Tue, 1 Oct 2024 12:28:49 -0300 Subject: [PATCH 2/2] (feat) add error message for backend api not running --- frontend/st_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/st_utils.py b/frontend/st_utils.py index 7a23fdb..984399e 100644 --- a/frontend/st_utils.py +++ b/frontend/st_utils.py @@ -74,14 +74,14 @@ def style_metric_cards( def get_backend_api_client(): from backend.services.backend_api_client import BackendAPIClient from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT - backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT) is_docker_running = False try: + backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT) is_docker_running = backend_api_client.is_docker_running() except Exception as e: st.error( - f"There was an error trying to connect to the Backend API: " - f"\n\n{str(e)} \n\nPlease make sure the Backend API is running.") + f"There was an error trying to connect to the Backend API. Please make sure the Backend API is running.\n\n" + f"Error: \n\n{str(e)}") st.stop() if not is_docker_running: st.error("Docker is not running. Please make sure Docker is running.")