@@ -404,23 +404,6 @@ class DeviceUnexpectedResponse(TeslaFleetError):
404404 status = 540
405405
406406
407- class PrivateKeyError (TeslaFleetError ):
408- """An existing private key file could not be loaded as a usable key.
409-
410- Raised by ``Tesla.get_private_key``/``get_rsa_private_key`` only for a
411- known-existing key file's read/parse failure - key generation and the
412- O_EXCL create-race fallback keep raising their original exceptions.
413- ``reason`` is one of ``"unreadable"`` (I/O failure), ``"malformed"`` (not
414- valid PEM), ``"encrypted"`` (PEM requires a passphrase), or
415- ``"wrong_type"`` (loaded key is not the expected type).
416- """
417-
418- def __init__ (self , reason : str , message : str ) -> None :
419- self .reason = reason
420- self .message = message
421- super ().__init__ ()
422-
423-
424407class LibraryError (Exception ):
425408 """Errors related to this library."""
426409
@@ -442,6 +425,25 @@ def __init__(self) -> None:
442425 )
443426
444427
428+ class PrivateKeyError (LibraryError ):
429+ """An existing private key file could not be loaded as a usable key.
430+
431+ Raised by ``Tesla.get_private_key``/``get_rsa_private_key`` only for a
432+ known-existing key file's read/parse failure - key generation and the
433+ O_EXCL create-race fallback keep raising their original exceptions.
434+ ``reason`` is one of ``"unreadable"`` (I/O failure), ``"malformed"`` (not
435+ valid PEM), ``"encrypted"`` (PEM requires a passphrase), or
436+ ``"wrong_type"`` (loaded key is not the expected type). A local key-file
437+ failure, not an upstream Fleet API error, so this subclasses
438+ ``LibraryError`` rather than ``TeslaFleetError``.
439+ """
440+
441+ def __init__ (self , reason : str , message : str ) -> None :
442+ self .reason = reason
443+ self .message = message
444+ super ().__init__ (message )
445+
446+
445447class SignedCommandRequired (TeslaFleetError ):
446448 """The requested action requires a signed command; the unsigned cloud API cannot actuate it.
447449
0 commit comments