From a8258b3f889825db7e28f3991cb738fabcf306e9 Mon Sep 17 00:00:00 2001 From: "shimoda.m@nds-tyo.co.jp" Date: Mon, 4 Sep 2023 16:43:45 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Excel/CSV=E3=81=AE=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E6=99=82=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/bio_download.py | 3 +- .../src/templates/bioSearchList.html | 34 +++++-------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/ecs/jskult-webapp/src/controller/bio_download.py b/ecs/jskult-webapp/src/controller/bio_download.py index f076f28b..0bcee13a 100644 --- a/ecs/jskult-webapp/src/controller/bio_download.py +++ b/ecs/jskult-webapp/src/controller/bio_download.py @@ -9,7 +9,6 @@ from starlette import status from src.depends.auth import verify_session from src.depends.services import get_service -from src.error.exceptions import DBException from src.logging.get_logger import get_logger from src.model.internal.session import UserSession from src.model.request.bio import BioModel @@ -114,7 +113,7 @@ def _search_bio_data( search_param, limitation=environment.BIO_EXCEL_RESULT_MAX_COUNT) elif download_param.ext == 'csv': search_result_df, query = bio_service.search_download_bio_data(search_param) - except DBException as e: + except Exception as e: raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail={'error': 'db_error', 'message': e.args} diff --git a/ecs/jskult-webapp/src/templates/bioSearchList.html b/ecs/jskult-webapp/src/templates/bioSearchList.html index a7035b28..37ccc19e 100644 --- a/ecs/jskult-webapp/src/templates/bioSearchList.html +++ b/ecs/jskult-webapp/src/templates/bioSearchList.html @@ -243,26 +243,28 @@ loading.stop(); $(`#modal_${ext}`).modal('toggle'); } catch (e) { - alert("エラーが発生しました。:" + e.message); + // 予期せぬエラーが発生した場合 + loading.stop(); + $(`#modal_${ext}`).modal('toggle'); + $(`#ErrorModal_Unexpected`).modal('toggle'); + return } }, error: function(jqXHR, textStatus, errorThrown) { + loading.stop() const responseJson = jqXHR.responseJSON if (responseJson?.detail?.error === 'db_error') { - loading.stop() $(`#modal_${ext}`).modal('toggle'); $(`#ErrorModal_DB`).modal('toggle'); return } if (responseJson?.detail?.error === 'aws_error') { - loading.stop(); $(`#modal_${ext}`).modal('toggle'); - $(`#ErrorModal_AWS`).modal('toggle'); + $(`#ErrorModal_Unexpected`).modal('toggle'); return } // 予期せぬエラーが発生した場合 - loading.stop(); $(`#modal_${ext}`).modal('toggle'); $(`#ErrorModal_Unexpected`).modal('toggle'); return @@ -425,29 +427,11 @@ %} {% include '_modal.html' %} {% endwith %} - - {% with - modal_id='ErrorModal_AWS', - modal_title='エラー', - message='AWS環境に異常が発生しました。管理者にお問い合わせください。', - icon_key='warning', - modal_close_event='location.href="/logout/?reason="', - buttons = [ - { - 'id': 'error_modal_aws', - 'class': 'btn btn-primary', - 'text': 'OK', - 'onclick_event': 'location.href="/logout/?reason=''"' - } - ] - %} - {% include '_modal.html' %} - {% endwith %} {% with modal_id='ErrorModal_DB', modal_title='エラー', - message='DB接続に失敗しました。管理者にお問い合わせください。', + message='DB接続に失敗しました。しばらく経ってから再度実行してください。', icon_key='warning', modal_close_event='location.href="/logout/?reason="', buttons = [ @@ -466,7 +450,7 @@ {% with modal_id='ErrorModal_Unexpected', modal_title='エラー', - message='サーバーエラーが発生しました。管理者にお問い合わせください。', + message='予期せぬエラーが発生しました。しばらく経ってから再度実行してください。', icon_key='warning', modal_close_event='location.href="/logout/?reason="', buttons = [