From d13848f0b720baaeb328a08533f6d25d39294e36 Mon Sep 17 00:00:00 2001 From: "vinicius.zevarex" Date: Sun, 14 Jan 2024 13:53:02 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20do=20status=20de=20retorno?= =?UTF-8?q?=20para=20conflito=20na=20inser=C3=A7=C3=A3o=20de=20um=20objeto?= =?UTF-8?q?=20repetido,=20erro=20Attribute=20already=20exists.=20(error:?= =?UTF-8?q?=20'=20+=20str(error)=20+=20')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/base.py b/controllers/base.py index 74f5638..08d8e58 100644 --- a/controllers/base.py +++ b/controllers/base.py @@ -573,7 +573,7 @@ def post_method_api_resource_create(self): except Error as error: if error.pgcode == "23505": # 23505 - unique_violation error = str(error).replace("\n", " ").split("DETAIL: ")[1] - raise HTTPError(400, "Attribute already exists. (error: " + str(error) + ")") + raise HTTPError(409, "Attribute already exists. (error: " + str(error) + ")") elif error.pgcode == "22023": # 22023 - invalid_parameter_value raise HTTPError(400, "One specified attribute is invalid. (error: " + str(error) + ")") else: