2024-11-22 18:09:33 +08:00
|
|
|
class PluginDaemonError(Exception):
|
|
|
|
"""Base class for all plugin daemon errors."""
|
|
|
|
|
|
|
|
def __init__(self, description: str) -> None:
|
|
|
|
self.description = description
|
|
|
|
|
2024-11-22 20:04:20 +08:00
|
|
|
def __str__(self) -> str:
|
|
|
|
# returns the class name and description
|
|
|
|
return f"{self.__class__.__name__}: {self.description}"
|
|
|
|
|
2024-11-22 18:09:33 +08:00
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginDaemonInternalError(PluginDaemonError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class PluginDaemonClientSideError(PluginDaemonError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class PluginDaemonInternalServerError(PluginDaemonInternalError):
|
2024-11-22 18:09:33 +08:00
|
|
|
description: str = "Internal Server Error"
|
|
|
|
|
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginDaemonUnauthorizedError(PluginDaemonInternalError):
|
|
|
|
description: str = "Unauthorized"
|
2024-11-22 18:09:33 +08:00
|
|
|
|
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginDaemonNotFoundError(PluginDaemonInternalError):
|
2024-11-22 18:09:33 +08:00
|
|
|
description: str = "Not Found"
|
|
|
|
|
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginDaemonBadRequestError(PluginDaemonClientSideError):
|
|
|
|
description: str = "Bad Request"
|
|
|
|
|
|
|
|
|
|
|
|
class PluginInvokeError(PluginDaemonClientSideError):
|
2024-11-28 17:12:29 +08:00
|
|
|
description: str = "Invoke Error"
|
|
|
|
|
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginUniqueIdentifierError(PluginDaemonClientSideError):
|
2024-11-22 18:09:33 +08:00
|
|
|
description: str = "Unique Identifier Error"
|
|
|
|
|
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginNotFoundError(PluginDaemonClientSideError):
|
2024-11-22 18:09:33 +08:00
|
|
|
description: str = "Plugin Not Found"
|
|
|
|
|
|
|
|
|
2024-11-28 20:44:06 +08:00
|
|
|
class PluginPermissionDeniedError(PluginDaemonClientSideError):
|
2024-11-22 18:09:33 +08:00
|
|
|
description: str = "Permission Denied"
|