Skip to content

Commit f97b7c4

Browse files
committed
Do not raise AssertionError when communicating with a non-Vuforia server
1 parent a3eec22 commit f97b7c4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/vws/vws.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ def _make_request(
156156
HTML page with the text "Oops, an error occurred". This has
157157
been seen to happen when the given name includes a bad
158158
character.
159+
json.decoder.JSONDecodeError: The server did not respond with valid
160+
JSON. This may happen if the server address is not a valid
161+
Vuforia server.
159162
"""
160163
response = _target_api_request(
161164
server_access_key=self._server_access_key,
@@ -166,11 +169,10 @@ def _make_request(
166169
base_vws_url=self._base_vws_url,
167170
)
168171

169-
try:
170-
result_code = response.json()['result_code']
171-
except json.decoder.JSONDecodeError as exc:
172-
assert 'Oops' in response.text, response.text
173-
raise UnknownVWSErrorPossiblyBadName() from exc
172+
if 'Oops, an error occurred' in response.text:
173+
raise UnknownVWSErrorPossiblyBadName
174+
175+
result_code = response.json()['result_code']
174176

175177
if result_code == expected_result_code:
176178
return response

0 commit comments

Comments
 (0)