aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
411 stars 184 forks source link

🐛 `RabbitmqBroker`: catch `ConnectionError` for `__str__` #6473

Closed mbercx closed 1 week ago

mbercx commented 2 weeks ago

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.

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.75%. Comparing base (ef60b66) to head (d3feec8). Report is 47 commits behind head on main.

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mbercx commented 1 week ago

@sphuber this one is ready for a second round of review!