Skip to content

Commit 693f353

Browse files
Dedup APIError (#229)
Co-authored-by: Justin Zhang <judtin@seas.upenn.edu>
1 parent 10be4f0 commit 693f353

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

backend/dining/api_wrapper.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
from requests.exceptions import ConnectTimeout, ReadTimeout
88

99
from dining.models import DiningItem, DiningMenu, DiningStation, Venue
10+
from utils.errors import APIError
1011

1112

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

1516

16-
class APIError(ValueError):
17-
pass
18-
19-
2017
class DiningAPIWrapper:
2118
def __init__(self):
2219
self.token = None

backend/gsr_booking/api_wrapper.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from gsr_booking.models import GSR, GroupMembership, GSRBooking, Reservation
1717
from gsr_booking.serializers import GSRBookingSerializer, GSRSerializer
18+
from utils.errors import APIError
1819

1920

2021
User = get_user_model()
@@ -38,10 +39,6 @@ class CreditType(Enum):
3839
ARB = "ARB"
3940

4041

41-
class APIError(ValueError):
42-
pass
43-
44-
4542
class AbstractBookingWrapper(ABC):
4643
@abstractmethod
4744
def book_room(self, rid, start, end, user):

backend/utils/errors.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class APIError(ValueError):
2+
pass

0 commit comments

Comments
 (0)