Files
lerobot-clone/lerobot/common/errors.py
Simon Alibert 3111ba78ad Add errors
2025-03-03 18:44:15 +01:00

24 lines
693 B
Python

class ConnectionError(Exception):
"""Base exception class for connection errors."""
pass
class DeviceNotConnectedError(ConnectionError):
"""Exception raised when the device is not connected."""
def __init__(self, message="This device is not connected. Try calling `connect()` first."):
self.message = message
super().__init__(self.message)
class DeviceAlreadyConnectedError(ConnectionError):
"""Exception raised when the device is already connected."""
def __init__(
self,
message="This device is already connected. Try not calling `connect()` twice.",
):
self.message = message
super().__init__(self.message)