Skip to content

Commit 8008021

Browse files
Merge pull request #1076 from adamtheturtle/client
Client
2 parents ac34952 + dc46d7c commit 8008021

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/vws/_result_codes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
from vws.exceptions import (
1010
AuthenticationFailure,
1111
BadImage,
12+
DateRangeError,
1213
Fail,
1314
ImageTooLarge,
1415
MetadataTooLarge,
1516
ProjectInactive,
17+
RequestQuotaReached,
1618
RequestTimeTooSkewed,
1719
TargetNameExist,
1820
TargetStatusNotSuccess,
@@ -52,11 +54,13 @@ def raise_for_result_code(
5254
exception = {
5355
'AuthenticationFailure': AuthenticationFailure,
5456
'BadImage': BadImage,
57+
'DateRangeError': DateRangeError,
5558
'Fail': Fail,
5659
'ImageTooLarge': ImageTooLarge,
5760
'InactiveProject': ProjectInactive,
5861
'MetadataTooLarge': MetadataTooLarge,
5962
'ProjectInactive': ProjectInactive,
63+
'RequestQuotaReached': RequestQuotaReached,
6064
'RequestTimeTooSkewed': RequestTimeTooSkewed,
6165
'TargetNameExist': TargetNameExist,
6266
'TargetStatusNotSuccess': TargetStatusNotSuccess,

src/vws/exceptions.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,22 @@ def response(self) -> Response:
156156
return self._response
157157

158158

159+
# See https://github.com/adamtheturtle/vws-python/issues/822.
160+
class RequestQuotaReached(Exception): # pragma: no cover
161+
"""
162+
Exception raised when Vuforia returns a response with a result code
163+
'RequestQuotaReached'.
164+
"""
165+
166+
def __init__(self, response: Response) -> None:
167+
"""
168+
Args:
169+
response: The response to a request to Vuforia.
170+
"""
171+
super().__init__()
172+
self.response = response
173+
174+
159175
class TargetStatusProcessing(Exception):
160176
"""
161177
Exception raised when Vuforia returns a response with a result code
@@ -303,6 +319,29 @@ def response(self) -> Response:
303319
return self._response
304320

305321

322+
# See https://github.com/adamtheturtle/vws-python/issues/846.
323+
class DateRangeError(Exception): # pragma: no cover
324+
"""
325+
Exception raised when Vuforia returns a response with a result code
326+
'DateRangeError'.
327+
"""
328+
329+
def __init__(self, response: Response) -> None:
330+
"""
331+
Args:
332+
response: The response to a request to Vuforia.
333+
"""
334+
super().__init__()
335+
self._response = response
336+
337+
@property
338+
def response(self) -> Response:
339+
"""
340+
The response returned by Vuforia which included this error.
341+
"""
342+
return self._response
343+
344+
306345
class TargetProcessingTimeout(Exception):
307346
"""
308347
Exception raised when waiting for a target to be processed times out.

0 commit comments

Comments
 (0)