Skip to content

Don't crash when reporting an exception that has no message - #2137

Merged
mig5 merged 1 commit into
onionshare:mainfrom
cristianchiriac:fix-generic-error-without-args
Oct 28, 2026
Merged

mig5 merged 1 commit into
onionshare:mainfrom
cristianchiriac:fix-generic-error-without-args

Conversation

@cristianchiriac

Copy link
Copy Markdown
Contributor

Fixes #2127.

OnionThread.run() (and the same pattern in TorConnectionThread.run() and AutoStartTimer.run()) formats unexpected errors with e.args[0]. Exceptions raised without arguments, like the stem.SocketClosed() in the Debian report, make that raise IndexError inside the except block, so the error signal is never emitted and the share stays stuck on "Starting...".

The message now falls back to the exception's class name when it has no arguments.

Added desktop/tests/test_threads.py, which runs OnionThread.run() with a mode whose start_onion_service raises stem.SocketClosed(). It fails with the IndexError before the change and passes after.

Some exceptions, such as stem.SocketClosed, are raised without
arguments, so formatting the generic error with e.args[0] raised an
IndexError inside the except block and the share got stuck. Fall back
to the exception's class name instead.

Fixes #2127
@mig5 mig5 added this to the 2.7.1 milestone Oct 28, 2026
@mig5
mig5 merged commit b43180e into onionshare:main Oct 28, 2026
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.

During handling of other exception IndexError: tuple index out of range

2 participants