Skip to content

Commit 4319e44

Browse files
Update comment on failure handling methodology.
1 parent 230f873 commit 4319e44

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ def create_queue(self, queue):
116116
"""Create a queue"""
117117

118118
queue_name = None
119-
# Yes, this isn't as pythonic as try/catching on failure, but there are lots of annoying subtleties such as if someone passes, for instance, a UUID
120-
# object instead of a string, or a Queue-like object elsewhere that doesn't implement the full Description contract, so I'm erring on the side of over-precision here.
121119
try:
122120
queue_name = queue.queue_name # type: ignore
123121
to_create = copy(queue)
@@ -138,6 +136,7 @@ def create_queue(self, queue):
138136
self._impl.queue.put(queue_name, request_body, api_version=constants.API_VERSION)
139137
)
140138
except ValidationError as e:
139+
# post-hoc try to give a somewhat-justifiable failure reason.
141140
if isinstance(queue, str) or (isinstance(queue, QueueDescription) and isinstance(queue.queue_name, str)):
142141
raise ValueError("queue must be a non-empty str or a QueueDescription with non-empty str queue_name", e)
143142
raise TypeError("queue must be a non-empty str or a QueueDescription with non-empty str queue_name", e)

0 commit comments

Comments
 (0)