cros_ec_python.exceptions
This file includes the exceptions raised from CrOS EC devices.
See cros_ec_python.constants.COMMON.EcStatus for possible error codes.
1""" 2This file includes the exceptions raised from CrOS EC devices. 3 4See `cros_ec_python.constants.COMMON.EcStatus` for possible error codes. 5""" 6 7from .constants.COMMON import EcStatus 8 9 10class ECError(IOError): 11 """ 12 Exception raised for errors in the EC interface. 13 14 See `cros_ec_python.constants.COMMON.EcStatus` for possible error codes. 15 """ 16 17 def __init__(self, status: int, message: str | None = None): 18 self.status: int = status 19 """The error code returned by the EC.""" 20 21 self.ec_status: EcStatus = EcStatus(status) 22 """The error code as an `cros_ec_python.constants.COMMON.EcStatus` enum.""" 23 24 self.status_str: str = self.ec_status.name 25 """The error code as a string.""" 26 27 self.message:str = f"EC returned error code {self.status_str} ({self.status})" if message is None else message 28 """A human-readable message describing the error.""" 29 30 super().__init__(self.message)
class
ECError(builtins.OSError):
11class ECError(IOError): 12 """ 13 Exception raised for errors in the EC interface. 14 15 See `cros_ec_python.constants.COMMON.EcStatus` for possible error codes. 16 """ 17 18 def __init__(self, status: int, message: str | None = None): 19 self.status: int = status 20 """The error code returned by the EC.""" 21 22 self.ec_status: EcStatus = EcStatus(status) 23 """The error code as an `cros_ec_python.constants.COMMON.EcStatus` enum.""" 24 25 self.status_str: str = self.ec_status.name 26 """The error code as a string.""" 27 28 self.message:str = f"EC returned error code {self.status_str} ({self.status})" if message is None else message 29 """A human-readable message describing the error.""" 30 31 super().__init__(self.message)
Exception raised for errors in the EC interface.
See cros_ec_python.constants.COMMON.EcStatus for possible error codes.
ECError(status: int, message: str | None = None)
18 def __init__(self, status: int, message: str | None = None): 19 self.status: int = status 20 """The error code returned by the EC.""" 21 22 self.ec_status: EcStatus = EcStatus(status) 23 """The error code as an `cros_ec_python.constants.COMMON.EcStatus` enum.""" 24 25 self.status_str: str = self.ec_status.name 26 """The error code as a string.""" 27 28 self.message:str = f"EC returned error code {self.status_str} ({self.status})" if message is None else message 29 """A human-readable message describing the error.""" 30 31 super().__init__(self.message)
ec_status: cros_ec_python.constants.COMMON.EcStatus
The error code as an cros_ec_python.constants.COMMON.EcStatus enum.