Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/vws/_result_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
Fail,
ImageTooLarge,
MetadataTooLarge,
ProjectHasNoAPIAccess,
ProjectInactive,
ProjectSuspended,
RequestQuotaReached,
RequestTimeTooSkewed,
TargetNameExist,
TargetQuotaReached,
TargetStatusNotSuccess,
TargetStatusProcessing,
UnknownTarget,
Expand Down Expand Up @@ -59,10 +62,13 @@ def raise_for_result_code(
'ImageTooLarge': ImageTooLarge,
'InactiveProject': ProjectInactive,
'MetadataTooLarge': MetadataTooLarge,
'ProjectHasNoAPIAccess': ProjectHasNoAPIAccess,
'ProjectInactive': ProjectInactive,
'ProjectSuspended': ProjectSuspended,
'RequestQuotaReached': RequestQuotaReached,
'RequestTimeTooSkewed': RequestTimeTooSkewed,
'TargetNameExist': TargetNameExist,
'TargetQuotaReached': TargetQuotaReached,
'TargetStatusNotSuccess': TargetStatusNotSuccess,
'TargetStatusProcessing': TargetStatusProcessing,
'UnknownTarget': UnknownTarget,
Expand Down
71 changes: 70 additions & 1 deletion src/vws/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def target_id(self) -> str:
return path.split(sep='/', maxsplit=2)[-1]


# See https://github.com/adamtheturtle/vws-python/issues/846.
# This is not simulated by the mock.
class DateRangeError(Exception): # pragma: no cover
"""
Exception raised when Vuforia returns a response with a result code
Expand All @@ -384,6 +384,75 @@ def response(self) -> Response:
return self._response


# This is not simulated by the mock.
class TargetQuotaReached(Exception): # pragma: no cover
"""
Exception raised when Vuforia returns a response with a result code
'TargetQuotaReached'.
"""

def __init__(self, response: Response) -> None:
"""
Args:
response: The response to a request to Vuforia.
"""
super().__init__()
self._response = response

@property
def response(self) -> Response:
"""
The response returned by Vuforia which included this error.
"""
return self._response


# This is not simulated by the mock.
class ProjectSuspended(Exception): # pragma: no cover
"""
Exception raised when Vuforia returns a response with a result code
'ProjectSuspended'.
"""

def __init__(self, response: Response) -> None:
"""
Args:
response: The response to a request to Vuforia.
"""
super().__init__()
self._response = response

@property
def response(self) -> Response:
"""
The response returned by Vuforia which included this error.
"""
return self._response


# This is not simulated by the mock.
class ProjectHasNoAPIAccess(Exception): # pragma: no cover
"""
Exception raised when Vuforia returns a response with a result code
'ProjectHasNoAPIAccess'.
"""

def __init__(self, response: Response) -> None:
"""
Args:
response: The response to a request to Vuforia.
"""
super().__init__()
self._response = response

@property
def response(self) -> Response:
"""
The response returned by Vuforia which included this error.
"""
return self._response


class TargetProcessingTimeout(Exception):
"""
Exception raised when waiting for a target to be processed times out.
Expand Down