From d44301ef14167ae3374b61bae2fda2086a199506 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Sat, 18 May 2024 22:38:08 +0200 Subject: [PATCH] feat: catch missing dist error --- web.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/web.py b/web.py index 3637ee0..90dc8f5 100755 --- a/web.py +++ b/web.py @@ -30,14 +30,22 @@ sentry_sdk.init( @app.route('/') def home(): - return send_from_directory('dist', 'index.html') + try: + return send_from_directory('dist', 'index.html') + except: + print(' ! dist folder missing') + return 'dist folder missing' @app.route('/') def dist(path): - if '.' in path: - return send_from_directory('dist', path) - else: - return send_from_directory('dist', path + '/index.html') + try: + if '.' in path: + return send_from_directory('dist', path) + else: + return send_from_directory('dist', path + '/index.html') + except: + print(' ! dist folder missing') + return 'dist folder missing' @app.errorhandler(404) def not_found(e):