From 9c32be458871ba67140ca9d0ae4264c9d9691c65 Mon Sep 17 00:00:00 2001 From: moririn2528 Date: Thu, 17 Aug 2023 16:14:16 +0900 Subject: [PATCH] uniform internal error style --- optuna_dashboard/_app.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index 7aae8864..256ddbb6 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -310,11 +310,7 @@ def create_app( response.status = 400 # Bad request return {"reason": "values attribute must be an array of numbers"} - try: - storage.set_trial_state_values(trial_id, state, values) - except Exception as e: - response.status = 500 - return {"reason": f"Internal server error: {e}"} + storage.set_trial_state_values(trial_id, state, values) response.status = 204 return {} @@ -327,12 +323,8 @@ def create_app( response.status = 400 # Bad request return {"reason": "user_attrs must be specified."} - try: - for key, val in user_attrs.items(): - storage.set_trial_user_attr(trial_id, key, val) - except Exception as e: - response.status = 500 - return {"reason": f"Internal server error: {e}"} + for key, val in user_attrs.items(): + storage.set_trial_user_attr(trial_id, key, val) response.status = 204 return {}