From 79681fcee0c237498793a7a92b1eb657e6da086e Mon Sep 17 00:00:00 2001 From: dlpzx Date: Thu, 8 Feb 2024 07:37:05 +0100 Subject: [PATCH] Cleaner error message --- backend/dataall/base/db/exceptions.py | 2 +- .../dataall/core/environment/services/environment_service.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/dataall/base/db/exceptions.py b/backend/dataall/base/db/exceptions.py index 20b8c9973..6a4abdfa0 100644 --- a/backend/dataall/base/db/exceptions.py +++ b/backend/dataall/base/db/exceptions.py @@ -54,7 +54,7 @@ def __init__(self, param_name, param_value, constraint): self.param_name = param_name self.param_value = param_value self.message = f""" - An error occurred (InvalidInput): f'{param_name} value {param_value} must be {constraint}' + An error occurred (InvalidInput): '{param_name} value {param_value} must be {constraint}' """ def __str__(self): diff --git a/backend/dataall/core/environment/services/environment_service.py b/backend/dataall/core/environment/services/environment_service.py index bd2fa8eba..65696d946 100644 --- a/backend/dataall/core/environment/services/environment_service.py +++ b/backend/dataall/core/environment/services/environment_service.py @@ -160,10 +160,11 @@ def _validate_resource_prefix(data): def _validate_account_region(data, session): environment = EnvironmentRepository.find_environment_by_account_region(session=session, account_id=data.get('AwsAccountId'), region=data.get('region')) if environment: + # An error occurred (InvalidInput): f'AwsAccount/region value 081212569412/eu-west-1 must be An environment for AwsAccount/region already exists' raise exceptions.InvalidInput( 'AwsAccount/region', f"{data.get('AwsAccountId')}/{data.get('region')}", - 'An environment for AwsAccount/region already exists', + f"unique. An environment for {data.get('AwsAccountId')}/{data.get('region')} already exists", ) @staticmethod