Skip to content

Commit

Permalink
Potential fix for code scanning alert no. 15: Information exposure th…
Browse files Browse the repository at this point in the history
…rough an exception (#305)

* Potential fix for code scanning alert no. 15: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Update organisation_views.py

* Update organisation_views.py

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 5011318 commit e1b2f67
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions django_project/base/organisation_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.db import IntegrityError

import logging

Invitation = get_invitation_model()

Expand Down Expand Up @@ -292,8 +292,11 @@ def delete_organisation_member(request):
)

except Exception as e:
logging.error(
"An error occurred while deleting organisation member: %s",
str(e))
return JsonResponse(
{"error": "An error occurred.", "details": str(e)},
{"error": "An internal error has occurred."},
status=500
)

Expand Down Expand Up @@ -347,16 +350,17 @@ def fetch_organisation_data(request):
return JsonResponse(data, status=200)

except AttributeError as e:
logging.error("User profile setup error: %s", str(e))
return JsonResponse(
{
"error": "User profile is not set up correctly.",
"details": str(e),
},
{"error": "User profile is not set up correctly."},
status=500,
)
except Exception as e:
logging.error(
"An unexpected error occurred: %s",
str(e))
return JsonResponse(
{"error": "An unexpected error occurred.", "details": str(e)},
{"error": "An unexpected error has occurred."},
status=500,
)

Expand Down

0 comments on commit e1b2f67

Please sign in to comment.