forked from tangger/lerobot
Add errors
This commit is contained in:
23
lerobot/common/errors.py
Normal file
23
lerobot/common/errors.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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)
|
||||||
Reference in New Issue
Block a user