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
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
Next
----

* Removed ``vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadName`` which now does not occur in VWS.

2024.09.21
------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ optional-dependencies.dev = [
"sybil==9.1.0",
"types-requests==2.32.0.20250306",
"vulture==2.14",
"vws-python-mock==2025.2.21",
"vws-python-mock==2025.3.10",
"vws-test-fixtures==2023.3.5",
"yamlfix==1.17.0",
]
Expand Down
25 changes: 0 additions & 25 deletions src/vws/exceptions/custom_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,6 @@
from vws.response import Response


@beartype
class OopsAnErrorOccurredPossiblyBadNameError(Exception):
"""Exception raised when VWS returns an HTML page which says "Oops, an
error occurred".

This has been seen to happen when the given name includes a bad
character.
"""

def __init__(self, response: Response) -> None:
"""
Args:
response: The response returned by Vuforia.
"""
super().__init__(response.text)
self._response = response

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


@beartype
class RequestEntityTooLargeError(Exception):
"""
Expand Down
17 changes: 2 additions & 15 deletions src/vws/vws.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from vws_auth_tools import authorization_header, rfc_1123_date

from vws.exceptions.custom_exceptions import (
OopsAnErrorOccurredPossiblyBadNameError,
ServerError,
TargetProcessingTimeoutError,
)
Expand Down Expand Up @@ -178,12 +177,6 @@ def make_request(
The response to the request made by `requests`.

Raises:
~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError:
Vuforia returns an HTML page with the text "Oops, an error
occurred".

This has been seen to happen when the given name includes a bad
character.
~vws.exceptions.custom_exceptions.ServerError: There is an error
with Vuforia's servers.
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
Expand All @@ -202,9 +195,6 @@ def make_request(
base_vws_url=self._base_vws_url,
)

if "Oops, an error occurred" in response.text:
raise OopsAnErrorOccurredPossiblyBadNameError(response=response)

if (
response.status_code == HTTPStatus.TOO_MANY_REQUESTS
): # pragma: no cover
Expand Down Expand Up @@ -290,12 +280,9 @@ def add_target(
inactive.
~vws.exceptions.vws_exceptions.RequestTimeTooSkewedError: There is
an error with the time sent to Vuforia.
~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError:
Vuforia returns an HTML page with the text "Oops, an error
occurred". This has been seen to happen when the given name
includes a bad character.
~vws.exceptions.custom_exceptions.ServerError: There is an error
with Vuforia's servers.
with Vuforia's servers. This has been seen to happen when the
given name includes a bad character.
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
rate limiting access.
"""
Expand Down
8 changes: 4 additions & 4 deletions tests/test_vws_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from vws import VWS
from vws.exceptions.base_exceptions import VWSError
from vws.exceptions.custom_exceptions import (
OopsAnErrorOccurredPossiblyBadNameError,
ServerError,
)
from vws.exceptions.vws_exceptions import (
AuthenticationFailureError,
Expand Down Expand Up @@ -71,13 +71,13 @@ def test_invalid_given_id(vws_client: VWS) -> None:

def test_add_bad_name(vws_client: VWS, high_quality_image: io.BytesIO) -> None:
"""
When a name with a bad character is given, an
``OopsAnErrorOccurredPossiblyBadName`` exception is raised.
When a name with a bad character is given, a ``ServerError`` exception is
raised.
"""
max_char_value = 65535
bad_name = chr(max_char_value + 1)
with pytest.raises(
expected_exception=OopsAnErrorOccurredPossiblyBadNameError
expected_exception=ServerError,
) as exc:
vws_client.add_target(
name=bad_name,
Expand Down