Skip to content

Commit

Permalink
added: default msg for exclusion violation
Browse files Browse the repository at this point in the history
  • Loading branch information
manthan-jsharma committed Sep 23, 2023
1 parent b7b3d45 commit 58dd459
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion mathesar/api/exceptions/database_exceptions/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class ExclusionViolationAPIException(MathesarAPIException):
def __init__(
self,
exception,
message="This column does not violate an exclusion constraint, so an exclusion constraint cannot be set",
message="The requested update violates an exclusion constraint",
field=None,
details=None,
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR
Expand Down
4 changes: 0 additions & 4 deletions mathesar/api/serializers/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class RecordListParameterSerializer(MathesarErrorMessageMixin, serializers.Seria


class RecordSerializer(MathesarErrorMessageMixin, serializers.BaseSerializer):
default_exclusion_violation_message = "The requested update violates an exclusion constraint"

def update(self, instance, validated_data):
table = self.context['table']
try:
Expand Down Expand Up @@ -58,7 +56,6 @@ def update(self, instance, validated_data):
elif type(e.orig) == ExclusionViolation:
raise database_api_exceptions.ExclusionViolationAPIException(
e,
message=self.default_exclusion_violation_message,
status_code=status.HTTP_400_BAD_REQUEST,
)
else:
Expand Down Expand Up @@ -91,7 +88,6 @@ def create(self, validated_data):
elif type(e.orig) == ExclusionViolation:
raise database_api_exceptions.ExclusionViolationAPIException(
e,
message=self.default_exclusion_violation_message,
status_code=status.HTTP_400_BAD_REQUEST,
)
else:
Expand Down

0 comments on commit 58dd459

Please sign in to comment.