Skip to content

Commit 711418d

Browse files
committed
IDEV-2020: Raise the exception at the end.
1 parent ee1577b commit 711418d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

domaintools/base_results.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,16 @@ def data(self):
150150
return self._data
151151

152152
def check_limit_exceeded(self):
153+
limit_exceeded, reason = False, ""
153154
if isinstance(self._data, dict) and (
154155
"response" in self._data and "limit_exceeded" in self._data["response"] and self._data["response"]["limit_exceeded"] is True
155156
):
156-
raise ServiceException(503, f"Limit Exceeded: {self._data['response']['message']}")
157+
limit_exceeded, reason = True, f"Limit Exceeded: {self._data['response']['message']}"
157158
elif "response" in self._data and "limit_exceeded" in self._data:
158-
raise ServiceException(503, "Limit Exceeded")
159+
limit_exceeded, reason = True, "Limit Exceeded"
160+
161+
if limit_exceeded:
162+
raise ServiceException(503, reason)
159163

160164
@property
161165
def status(self):

0 commit comments

Comments
 (0)