Skip to content

Improve exception string formatting#423

Open
lovewave02 wants to merge 1 commit into
ParallelSSH:masterfrom
lovewave02:enhance/friendly-exception-strings
Open

Improve exception string formatting#423
lovewave02 wants to merge 1 commit into
ParallelSSH:masterfrom
lovewave02:enhance/friendly-exception-strings

Conversation

@lovewave02

Copy link
Copy Markdown

What changed

Exceptions such as AuthenticationError keep a printf-style message and its
values in args, so their default string output currently looks like a tuple.

This adds a shared string representation that formats those values while
leaving args unchanged. Single-argument exceptions keep their existing
output, and invalid formats fall back to Python's normal exception formatting.

The behavior is covered by regression tests and documented in the exceptions
reference.

Verification

  • pytest (21 passed)
  • focused exception tests on Python 3.12 and 3.14
  • flake8 pssh
  • flake8 tests ci/integration_tests
  • python setup.py check --restructuredtext
  • python setup.py sdist bdist_wheel
  • Sphinx HTML build (four existing local libssh import warnings; identical on
    origin/master)

Resolves #404

@lovewave02

Copy link
Copy Markdown
Author

Python 3.12 is timing out in the existing integration suite, while 3.8, 3.11,
and 3.13 are green. The 3.12 unit-test step passed; the integration step reached
test_scp_recv_larger_files, then hit CircleCI's 10-minute no-output timeout on
all retries.

I also compared that test on the PR head and the pre-change commit in the same
cimg/python:3.12 container. Both failed in the existing SSH test setup, so I
couldn't reproduce a failure specific to this exception-formatting change.

Could you rerun the Python 3.12 job when convenient? I haven't pushed a
retry-only commit.

@pkittenis

Copy link
Copy Markdown
Member

Thanks for the interest and PR.

Changes look good, will retry the test on CircleCI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a more user friendly string representation of common errors

2 participants