diff --git a/Changelog b/Changelog index 78116089..6a36bcf3 100644 --- a/Changelog +++ b/Changelog @@ -1,7 +1,7 @@ Version 1.9.47 --------- - * Remote backup: catch socket exceptions accordingly, provide better - error message if connection fails. + * Remote backup: catch more exceptions accordingly, provide better + error message if ssh connection fails. Version 1.9.46 --------- diff --git a/libvirtnbdbackup/ssh/client.py b/libvirtnbdbackup/ssh/client.py index 436721a2..e601eef8 100644 --- a/libvirtnbdbackup/ssh/client.py +++ b/libvirtnbdbackup/ssh/client.py @@ -24,6 +24,7 @@ SFTPClient, SSHException, AuthenticationException, + BadHostKeyException, ) from libvirtnbdbackup.ssh import exceptions @@ -76,6 +77,8 @@ def connect(self) -> SSHClient: ) except socket.gaierror as e: raise exceptions.sshError(f"Unable to connect: {e}") + except BadHostKeyException as e: + raise exceptions.sshError(e) except Exception as e: log.exception(e) raise exceptions.sshError(f"Unknown exception occurred: {e}")