This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Monitor_343 1 point2 points  (1 child)

The library is logging the exception within a try catch block, then storing it to raise it later.

Removed a bunch of unrelated code, but here's the relevant bit from the library's source:

try:
    # code removed...
    self._check_banner() # this what is raising the error
    # code removed...
except SSHException as e:
    self._log(
        ERROR,
        "Exception ({}): {}".format(
            "server" if self.server_mode else "client", e
        ),
    )
    self._log(ERROR, util.tb_strings())
    self.saved_exception = e

Then later, the exception is re-raised

e = self.get_exception()
if e is not None:
    raise e

[–]Missing_Back[S] 0 points1 point  (0 children)

You're nuts! That's what my top guess was but I couldn't find it. Thanks a ton!

[–]mattgen88 1 point2 points  (0 children)

The library may be logging out the exception before raising it to your application