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:
2323 QueueSpecification (name = queue_name , queue_type = QueueType .quorum , arguments = {})
2424 )
2525
26- binding_exchange_queue_path = management .bind (
26+ management .bind (
2727 BindingSpecification (
2828 source_exchange = exchange_name ,
2929 destination_queue = queue_name ,
@@ -49,7 +49,7 @@ def main() -> None:
4949 publisher.close()
5050 """
5151
52- management .unbind (binding_exchange_queue_path )
52+ # management.unbind(binding_exchange_queue_path)
5353
5454 """
5555 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 2121 ExchangeSpecification ,
2222 QueueSpecification ,
2323)
24+ from .exceptions import ValidationCodeException
2425from .options import ReceiverOption , SenderOption
2526
2627
@@ -131,8 +132,8 @@ def declare_queue(
131132 path ,
132133 CommonValues .command_put .value ,
133134 [
135+ CommonValues .response_code_200 .value ,
134136 CommonValues .response_code_201 .value ,
135- CommonValues .response_code_204 .value ,
136137 CommonValues .response_code_409 .value ,
137138 ],
138139 )
@@ -171,13 +172,15 @@ def _validate_reponse_code(
171172 print ("response_code received: " + str (response_code ))
172173 if response_code == CommonValues .response_code_409 .value :
173174 # TODO replace with a new defined Exception
174- raise Exception ("ErrPreconditionFailed" )
175+ raise ValidationCodeException ("ErrPreconditionFailed" )
175176
176177 for code in expected_response_codes :
177178 if code == response_code :
178179 return None
179180
180- raise Exception ("wrong response code received" )
181+ raise ValidationCodeException (
182+ "wrong response code received: " + str (response_code )
183+ )
181184
182185 # TODO
183186 def bind (self , bind_specification : BindingSpecification ) -> str :
You can’t perform that action at this time.
0 commit comments