-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 RabbitmqBroker
: catch ConnectionError
for __str__
#6473
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6473 +/- ##
==========================================
+ Coverage 77.51% 77.75% +0.25%
==========================================
Files 560 561 +1
Lines 41444 41771 +327
==========================================
+ Hits 32120 32476 +356
+ Misses 9324 9295 -29 ☔ View full report in Codecov by Sentry. |
The current implementation of the `RabbitmqBroker.__str__()` method always prints both the version and the URL of the RabbitMQ server. However, the `get_rabbitmq_version()` method fails with a `ConnectionError` in case the RabbitMQ broker is not able to connect to the server. This issue would bubble up into the `verdi status` command, since this prints the string representation of the `RabbitmqBroker` in the message that reports the connection failure. At this point the `ConnectionError` is no longer caught, and hence the user is exposed to the full traceback. Here we adapt the `RabbitmqBroker.__str__()` method to catch the `ConnectionError` and only return the URL in this case.
@sphuber this one is ready for a second round of review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mbercx
…6473) The current implementation of the `RabbitmqBroker.__str__()` method always prints both the version and the URL of the RabbitMQ server. However, the `get_rabbitmq_version()` method fails with a `ConnectionError` in case the RabbitMQ broker is not able to connect to the server. This issue would bubble up into the `verdi status` command, since this prints the string representation of the `RabbitmqBroker` in the message that reports the connection failure. At this point the `ConnectionError` is no longer caught, and hence the user is exposed to the full traceback. Here we adapt the `RabbitmqBroker.__str__()` method to catch the `ConnectionError` and return the URL with the message that the connection failed.
The current implementation of the
RabbitmqBroker.__str__()
method always prints both the version and the URL of the RabbitMQ server. However, theget_rabbitmq_version()
method fails with aConnectionError
in case the RabbitMQ broker is not able to connect to the server.This issue would bubble up into the
verdi status
command, since this prints the string representation of theRabbitmqBroker
in the message that reports the connection failure. At this point theConnectionError
is no longer caught, and hence the user is exposed to the full traceback.Here we adapt the
RabbitmqBroker.__str__()
method to catch theConnectionError
and only return the URL in this case.