File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
rabbitmq_amqp_python_client Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def main() -> None:
23
23
QueueSpecification (name = queue_name , queue_type = QueueType .quorum , arguments = {})
24
24
)
25
25
26
- binding_exchange_queue_path = management .bind (
26
+ management .bind (
27
27
BindingSpecification (
28
28
source_exchange = exchange_name ,
29
29
destination_queue = queue_name ,
@@ -49,7 +49,7 @@ def main() -> None:
49
49
publisher.close()
50
50
"""
51
51
52
- management .unbind (binding_exchange_queue_path )
52
+ # management.unbind(binding_exchange_queue_path)
53
53
54
54
"""
55
55
management.purge_queue(queue_info.name)
Original file line number Diff line number Diff line change
1
+ class ValidationCodeException (Exception ):
2
+ # Constructor or Initializer
3
+ def __init__ (self , msg : str ):
4
+ self .msg = msg
5
+
6
+ # __str__ is to print() the value
7
+ def __str__ (self ) -> str :
8
+ return repr (self .msg )
Original file line number Diff line number Diff line change 21
21
ExchangeSpecification ,
22
22
QueueSpecification ,
23
23
)
24
+ from .exceptions import ValidationCodeException
24
25
from .options import ReceiverOption , SenderOption
25
26
26
27
@@ -131,8 +132,8 @@ def declare_queue(
131
132
path ,
132
133
CommonValues .command_put .value ,
133
134
[
135
+ CommonValues .response_code_200 .value ,
134
136
CommonValues .response_code_201 .value ,
135
- CommonValues .response_code_204 .value ,
136
137
CommonValues .response_code_409 .value ,
137
138
],
138
139
)
@@ -171,13 +172,15 @@ def _validate_reponse_code(
171
172
print ("response_code received: " + str (response_code ))
172
173
if response_code == CommonValues .response_code_409 .value :
173
174
# TODO replace with a new defined Exception
174
- raise Exception ("ErrPreconditionFailed" )
175
+ raise ValidationCodeException ("ErrPreconditionFailed" )
175
176
176
177
for code in expected_response_codes :
177
178
if code == response_code :
178
179
return None
179
180
180
- raise Exception ("wrong response code received" )
181
+ raise ValidationCodeException (
182
+ "wrong response code received: " + str (response_code )
183
+ )
181
184
182
185
# TODO
183
186
def bind (self , bind_specification : BindingSpecification ) -> str :
You can’t perform that action at this time.
0 commit comments