Skip to content

Commit

Permalink
Refactor(paid event)/rename exception (#717)
Browse files Browse the repository at this point in the history
* refactored exception for order init error

* added error when trying to update a paid event to a free event

* changed name of exception

* Trigger Build
  • Loading branch information
MadsNyl authored Oct 13, 2023
1 parent 96ecf8d commit 360abc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/content/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rest_framework.exceptions import APIException


class APIEventIsPaidEventException(APIException):
class APIPaidEventCantBeChangedToFreeEventException(APIException):
status_code = status.HTTP_400_BAD_REQUEST
default_detail = "Arrangementet er et betalt arrangement, og kan ikke endres til et gratis arrangement"

Expand Down
4 changes: 2 additions & 2 deletions app/content/serializers/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from app.common.enums import GroupType
from app.common.serializers import BaseModelSerializer
from app.content.exceptions import APIEventIsPaidEventException
from app.content.exceptions import APIPaidEventCantBeChangedToFreeEventException
from app.content.models import Event, PriorityPool
from app.content.serializers.priority_pool import (
PriorityPoolCreateSerializer,
Expand Down Expand Up @@ -179,7 +179,7 @@ def update(self, instance, validated_data):
)

if event.is_paid_event and not len(paid_information_data):
raise APIEventIsPaidEventException()
raise APIPaidEventCantBeChangedToFreeEventException()

if len(paid_information_data):
self.update_paid_information(event, paid_information_data)
Expand Down

0 comments on commit 360abc5

Please sign in to comment.