Skip to content

Commit 3b7e7d6

Browse files
committed
In TargetNameExist, capture the target name which already exists
1 parent abc0023 commit 3b7e7d6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/vws/exceptions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,13 @@ def response(self) -> Response:
285285
"""
286286
return self._response
287287

288+
@property
289+
def target_name(self) -> str:
290+
"""
291+
The target name which already exists.
292+
"""
293+
return self.response.request.json()['name']
294+
288295

289296
class ImageTooLarge(Exception):
290297
"""

tests/test_exceptions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def test_target_name_exist(
149149
)
150150

151151
assert exc.value.response.status_code == codes.FORBIDDEN
152+
assert exc.value.target_name == 'x'
152153

153154

154155
def test_project_inactive(

0 commit comments

Comments
 (0)