From ed44e19766af608d949ecb988f9830f98b0c768e Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 13 Apr 2023 10:41:28 +0530 Subject: [PATCH] Update error message for GET request with missing parameters Signed-off-by: Shreya --- src/rest_service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rest_service.py b/src/rest_service.py index d2a5411..39ba3fd 100644 --- a/src/rest_service.py +++ b/src/rest_service.py @@ -100,7 +100,12 @@ def do_GET(self): if re.search(HPOSupportedTypes.API_ENDPOINT, self.path): query = parse_qs(urlparse(self.path).query) if "experiment_name" not in query or "trial_number" not in query: - error_msg = HPOErrorConstants.MISSING_PARAMETERS + missing_params = [] + if "experiment_name" not in query: + missing_params.append("experiment_name") + if "trial_number" not in query: + missing_params.append("trial_number") + error_msg = HPOErrorConstants.MISSING_PARAMETERS[:-1] + ": " + ", ".join(str(param) for param in missing_params) logger.error(error_msg) self._set_response(400, error_msg) return