Skip to content

Provide a more user friendly string representation of common errors #404

@andy-slac

Description

@andy-slac

For general questions please use the mail group.

Describe the bug
AuthenticationError (and maybe other exceptions) is rendered in a confusing way when printed (or converted to string. It looks like:

('Authentication error while connecting to %s:%s - %s - retries %s/%s', 'host.example.com', 22, AuthenticationError('No authentication methods succeeded'), 3, 3)

To Reproduce

Steps to reproduce the behavior:

  1. Example code that produces error:
python -c 'from pssh.clients import SSHClient; SSHClient("localhost", user="_dummy_").run_command("echo")'
  1. Stack trace or error messages.
...
  File ".../site-packages/pssh/clients/base/single.py", line 271, in _auth_retry
    raise AuthenticationError(msg, self.host, self.port, ex, retries, self.num_retries)
pssh.exceptions.AuthenticationError: ('Authentication error while connecting to %s:%s - %s - retries %s/%s', 'localhost', 22, AuthenticationError('No authentication methods succeeded'), 3, 3)

Expected behavior
I think it would be better if exception was rendered with all pieces combined like

pssh.exceptions.AuthenticationError: Authentication error while connecting to localhost:22 - AuthenticationError('No authentication methods succeeded') - retries 3/3

Actual behaviour
Exception is printed like a tuple.

Additional information

>>> pssh.__version__
'0+untagged.23.g024d798.dirty'
>>> ssh2.__version__
'1.1.1'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions