Skip to content

Commit

Permalink
ssh: improve error message on failed key generation
Browse files Browse the repository at this point in the history
The output can be present, but blank, so make sure we give a reasonable
error message.

See #10037
  • Loading branch information
nijel committed Oct 2, 2023
1 parent ce232a3 commit d857a43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions weblate/vcs/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ def generate_ssh_key(request, key_type: str = "rsa"):
env=get_clean_env(),
)
except (subprocess.CalledProcessError, OSError) as exc:
messages.error(
request,
gettext("Could not generate key: %s") % getattr(exc, "output", str(exc)),
)
error = getattr(exc, "output", "")
if not error:
error = str(exc)
messages.error(request, gettext("Could not generate key: %s") % error)
return

# Fix key permissions
Expand Down

0 comments on commit d857a43

Please sign in to comment.