Descriptive CLI Error Messages
The arguments -X
, -H
, -u
, and -p
are all currently required to successfully run amqpfind. As it stands now, when a user doesn't specify one of the previous options, amqpfind will spit out a cryptic error message:
...
File "/Users/mdrexler/.venv/lib/python3.12/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
raise self._reap_last_connection_workflow_error(error)
File "/Users/mdrexler/.venv/lib/python3.12/site-packages/pika/connection.py", line 1855, in _on_connection_start
self._send_connection_start_ok(*self._get_credentials(method_frame))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdrexler/.venv/lib/python3.12/site-packages/pika/connection.py", line 1643, in _get_credentials
response) = self.params.credentials.response_for(method_frame.method)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdrexler/.venv/lib/python3.12/site-packages/pika/credentials.py", line 79, in response_for
b'\0' + as_bytes(self.username) + b'\0' + as_bytes(self.password))
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdrexler/.venv/lib/python3.12/site-packages/pika/compat.py", line 186, in as_bytes
return value.encode('UTF-8')
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
It would be nice to improve the error messages when one of the flags are missing so users know why their amqpfind command isn't working.