[rabbitmq-discuss] how to detect bad username/password in 0.9.5?

Brandon Craig Rhodes brandon.craig.rhodes at gmail.com
Thu May 5 16:17:28 BST 2011


When a error occurs while connecting in Pika 0.9.5, I have to go log on
to my RabbitMQ server and look at its logs to discover what happened -
the IOLoop in the local program simply returns after three seconds and
my next piece of code breaks because the `on_open_callback` callback
that I am passing to my `SelectConnection` never gets called when the
username and password are wrong.

How am I supposed to intercept this condition so that I can return an
error message to my user?  I tried registering a callback with the
`connection.add_on_close_callback()` method but, sensibly enough, it
never gets called because this is not really a connection-close, but a
connection not getting established in the first place.  I have looked
around for some sort of a `connection.add_on_error_callback()` or some
similar sort of facility, but cannot find one.

How do I catch and handle asynchronous errors?

Thanks for ANY help that you guys can offer - and thanks, Gavin, for
writing such an important part of the modern Python ecosystem!

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon


More information about the rabbitmq-discuss mailing list