26 lines
793 B
Python
26 lines
793 B
Python
|
|
from common.exceptions.app_exception import (
|
||
|
|
NotFoundException,
|
||
|
|
ConflictException
|
||
|
|
)
|
||
|
|
|
||
|
|
class DeviceNotFoundException(NotFoundException):
|
||
|
|
def __init__(self, device_id):
|
||
|
|
super().__init__(
|
||
|
|
message=f"Device not found with id={device_id}",
|
||
|
|
payload={"device_id": device_id}
|
||
|
|
)
|
||
|
|
|
||
|
|
class DeviceAlreadyExistsException(ConflictException):
|
||
|
|
def __init__(self, name):
|
||
|
|
super().__init__(
|
||
|
|
message=f"Device already exists with name={name}",
|
||
|
|
payload={"name": name}
|
||
|
|
)
|
||
|
|
|
||
|
|
class DeviceIPAlreadyExistsException(ConflictException):
|
||
|
|
def __init__(self, ip_address):
|
||
|
|
super().__init__(
|
||
|
|
message=f"Device already exists with IP address={ip_address}",
|
||
|
|
payload={"ip_address": ip_address}
|
||
|
|
)
|