Skip to content

Commit

Permalink
Cleaner error message
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpzx committed Feb 8, 2024
1 parent 661d96b commit 79681fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/dataall/base/db/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 79681fc

Please sign in to comment.