Skip to content

Commit

Permalink
fix:Healthlane-Technologies#170 error handling message Healthlane-Tec…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisMcLernon committed Jun 21, 2024
1 parent d622624 commit 5acb82c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ def add_arguments(self, parser):
def handle(self, *app_labels, **options):
is_test_mode = options["test"]
tenant = options["workspace"]
tenant_obj = TenantModel.objects.get(name=tenant)
while True:
try:
tenant_obj = TenantModel.objects.get(name=workspace)
break # Exit the loop if a valid workspace is found
except TenantModel.DoesNotExist:
self.stdout.write(self.style.ERROR(f"The app name '{workspace}' provided as an argument is invalid. Please ensure that you have entered the correct app name and try again."))
workspace = input('Please enter a valid workspace: ')
options['workspace'] = workspace

connection.set_tenant(tenant_obj)
if is_test_mode:
connection.settings_dict["NAME"] = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ def add_arguments(self, parser):
parser.add_argument("--package", help="Run the migrations for the package")

def handle(self, *args, **options):
tenant_obj = TenantModel.objects.get(name=options["workspace"])
while True:
try:
tenant_obj = TenantModel.objects.get(name=workspace)
break # Exit the loop if a valid workspace is found
except TenantModel.DoesNotExist:
self.stdout.write(self.style.ERROR(f"The app name '{workspace}' provided as an argument is invalid. Please ensure that you have entered the correct app name and try again."))
workspace = input('Please enter a valid workspace: ')
options['workspace'] = workspace

is_test_mode = options["test"]
if is_test_mode:
connection.settings_dict["NAME"] = (
Expand Down

0 comments on commit 5acb82c

Please sign in to comment.