From e0aa05f06359758ac25aec16a3fa388df1cff664 Mon Sep 17 00:00:00 2001 From: keisuke umezawa Date: Wed, 25 Jan 2023 10:30:50 +0900 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Masashi Shibata --- optuna_dashboard/_app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index b3933220..e5565294 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -412,7 +412,7 @@ def create_app(storage: BaseStorage, debug: bool = False) -> Bottle: response.status = 204 # No content return {} - @app.post("/api/studies//tell") + @app.post("/api/trials//tell") @json_api_view def tell_trial(trial_id: int) -> BottleViewReturn: s = request.json.get("state", None) @@ -445,10 +445,10 @@ def create_app(storage: BaseStorage, debug: bool = False) -> Bottle: try: storage.set_trial_state_values(trial_id, state, values) except Exception as e: - response.status = 400 # Bad request - return {"reason": e.args} + response.status = 500 + return {"reason": f"Internal server error: {e}"} - response.status = 201 + response.status = 204 return {} @app.put("/api/studies///note")