Raise KeyError when signing key is not loaded into SSH agent
Marco Ricci

Marco Ricci commited on 2024-06-30 16:37:52
Zeige 1 geänderte Dateien mit 2 Einfügungen und 2 Löschungen.

... ...
@@ -327,7 +327,7 @@ class SSHAgentClient:
327 327
                 The response from the SSH agent is too long.
328 328
             RuntimeError:
329 329
                 The agent failed to complete the request.
330
-            RuntimeError:
330
+            KeyError:
331 331
                 `check_if_key_loaded` is true, and the `key` was not
332 332
                 loaded into the agent.
333 333
 
... ...
@@ -335,7 +335,7 @@ class SSHAgentClient:
335 335
         if check_if_key_loaded:
336 336
             loaded_keys = frozenset({pair.key for pair in self.list_keys()})
337 337
             if bytes(key) not in loaded_keys:
338
-                raise RuntimeError('target SSH key not loaded into agent')
338
+                raise KeyError('target SSH key not loaded into agent')
339 339
         request_data = bytearray(self.string(key))
340 340
         request_data.extend(self.string(payload))
341 341
         request_data.extend(self.uint32(flags))
342 342