Skip to content

Commit 086563f

Browse files
committed
Remove OopsAnErrorOccurredPossiblyBadName which matches error no longer found in Vuforia
1 parent bcc4f86 commit 086563f

File tree

4 files changed

+8
-44
lines changed

4 files changed

+8
-44
lines changed

CHANGELOG.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changelog
44
Next
55
----
66

7+
* Removed ``vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadName`` which now does not occur in VWS.
8+
79
2024.09.21
810
------------
911

src/vws/exceptions/custom_exceptions.py

-25
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,6 @@
99
from vws.response import Response
1010

1111

12-
@beartype
13-
class OopsAnErrorOccurredPossiblyBadNameError(Exception):
14-
"""Exception raised when VWS returns an HTML page which says "Oops, an
15-
error occurred".
16-
17-
This has been seen to happen when the given name includes a bad
18-
character.
19-
"""
20-
21-
def __init__(self, response: Response) -> None:
22-
"""
23-
Args:
24-
response: The response returned by Vuforia.
25-
"""
26-
super().__init__(response.text)
27-
self._response = response
28-
29-
@property
30-
def response(self) -> Response:
31-
"""
32-
The response returned by Vuforia which included this error.
33-
"""
34-
return self._response
35-
36-
3712
@beartype
3813
class RequestEntityTooLargeError(Exception):
3914
"""

src/vws/vws.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from vws_auth_tools import authorization_header, rfc_1123_date
1717

1818
from vws.exceptions.custom_exceptions import (
19-
OopsAnErrorOccurredPossiblyBadNameError,
2019
ServerError,
2120
TargetProcessingTimeoutError,
2221
)
@@ -178,12 +177,6 @@ def make_request(
178177
The response to the request made by `requests`.
179178
180179
Raises:
181-
~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError:
182-
Vuforia returns an HTML page with the text "Oops, an error
183-
occurred".
184-
185-
This has been seen to happen when the given name includes a bad
186-
character.
187180
~vws.exceptions.custom_exceptions.ServerError: There is an error
188181
with Vuforia's servers.
189182
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
@@ -202,9 +195,6 @@ def make_request(
202195
base_vws_url=self._base_vws_url,
203196
)
204197

205-
if "Oops, an error occurred" in response.text:
206-
raise OopsAnErrorOccurredPossiblyBadNameError(response=response)
207-
208198
if (
209199
response.status_code == HTTPStatus.TOO_MANY_REQUESTS
210200
): # pragma: no cover
@@ -290,12 +280,9 @@ def add_target(
290280
inactive.
291281
~vws.exceptions.vws_exceptions.RequestTimeTooSkewedError: There is
292282
an error with the time sent to Vuforia.
293-
~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError:
294-
Vuforia returns an HTML page with the text "Oops, an error
295-
occurred". This has been seen to happen when the given name
296-
includes a bad character.
297283
~vws.exceptions.custom_exceptions.ServerError: There is an error
298-
with Vuforia's servers.
284+
with Vuforia's servers. This has been seen to happen when the
285+
given name includes a bad character.
299286
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
300287
rate limiting access.
301288
"""

tests/test_vws_exceptions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from vws import VWS
1616
from vws.exceptions.base_exceptions import VWSError
1717
from vws.exceptions.custom_exceptions import (
18-
OopsAnErrorOccurredPossiblyBadNameError,
18+
ServerError,
1919
)
2020
from vws.exceptions.vws_exceptions import (
2121
AuthenticationFailureError,
@@ -71,13 +71,13 @@ def test_invalid_given_id(vws_client: VWS) -> None:
7171

7272
def test_add_bad_name(vws_client: VWS, high_quality_image: io.BytesIO) -> None:
7373
"""
74-
When a name with a bad character is given, an
75-
``OopsAnErrorOccurredPossiblyBadName`` exception is raised.
74+
When a name with a bad character is given, a ``ServerError`` exception is
75+
raised.
7676
"""
7777
max_char_value = 65535
7878
bad_name = chr(max_char_value + 1)
7979
with pytest.raises(
80-
expected_exception=OopsAnErrorOccurredPossiblyBadNameError
80+
expected_exception=ServerError,
8181
) as exc:
8282
vws_client.add_target(
8383
name=bad_name,

0 commit comments

Comments
 (0)