Skip to content

Commit

Permalink
Dedup APIError (#229)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Zhang <[email protected]>
  • Loading branch information
melaniechen912 and judtinzhang authored Mar 7, 2024
1 parent 10be4f0 commit 693f353
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions backend/dining/api_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
from requests.exceptions import ConnectTimeout, ReadTimeout

from dining.models import DiningItem, DiningMenu, DiningStation, Venue
from utils.errors import APIError


OPEN_DATA_URL = "https://3scale-public-prod-open-data.apps.k8s.upenn.edu/api/v1/dining/"
OPEN_DATA_ENDPOINTS = {"VENUES": OPEN_DATA_URL + "venues", "MENUS": OPEN_DATA_URL + "menus"}


class APIError(ValueError):
pass


class DiningAPIWrapper:
def __init__(self):
self.token = None
Expand Down
5 changes: 1 addition & 4 deletions backend/gsr_booking/api_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from gsr_booking.models import GSR, GroupMembership, GSRBooking, Reservation
from gsr_booking.serializers import GSRBookingSerializer, GSRSerializer
from utils.errors import APIError


User = get_user_model()
Expand All @@ -38,10 +39,6 @@ class CreditType(Enum):
ARB = "ARB"


class APIError(ValueError):
pass


class AbstractBookingWrapper(ABC):
@abstractmethod
def book_room(self, rid, start, end, user):
Expand Down
2 changes: 2 additions & 0 deletions backend/utils/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class APIError(ValueError):
pass

0 comments on commit 693f353

Please sign in to comment.