Skip to content

Commit

Permalink
refactor: Improve error handling in update_company_email view
Browse files Browse the repository at this point in the history
The update_company_email view has been refactored to improve error handling when no company is found with the specified domain. Instead of redirecting to the company list page, the view now redirects to the home page. This change provides a better user experience by ensuring that users are redirected to a relevant page when encountering an error.
  • Loading branch information
QA2A committed Sep 5, 2024
1 parent 4ea6db3 commit 709c46d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,8 +1601,8 @@ def update_company_email(request):
try:
companies = Company.objects.filter(website__icontains=domain)
if not companies.exists():
messages.error(request, "No company found with the specified domain.")
return redirect("company_list")
messages.error(request, "No company found with the specified domain of " + domain)
return redirect("home")

matched_company = None
for company in companies:
Expand Down

0 comments on commit 709c46d

Please sign in to comment.