93 lines
3.0 KiB
Python
93 lines
3.0 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
|
||
|
|
class PluginException(Exception):
|
||
|
|
def __init__(self, message: str = "", plugin_id: str = ""):
|
||
|
|
self.plugin_id = plugin_id
|
||
|
|
super().__init__(message)
|
||
|
|
|
||
|
|
|
||
|
|
class DuplicatePluginException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin already exists: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginNotFoundException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin not found: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginAlreadyRegisteredException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin already registered: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginAlreadyActivatedException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin already activated: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginNotConfiguredException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin not configured: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginAdapterNotFoundException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"adapter class not found for plugin: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginRegistrationException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin registration failed: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class PluginReloadException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"plugin reload failed: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class InvalidManifestException(PluginException):
|
||
|
|
def __init__(self, message: str):
|
||
|
|
super().__init__(f"invalid manifest: {message}")
|
||
|
|
|
||
|
|
|
||
|
|
class RegistryLockedException(PluginException):
|
||
|
|
def __init__(self):
|
||
|
|
super().__init__("registry is locked")
|
||
|
|
|
||
|
|
|
||
|
|
class SnapshotException(PluginException):
|
||
|
|
def __init__(self, message: str = "snapshot operation failed"):
|
||
|
|
super().__init__(message)
|
||
|
|
|
||
|
|
|
||
|
|
class ConfigValidationException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str, message: str):
|
||
|
|
super().__init__(f"config validation failed for {plugin_id}: {message}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class ConfigNotFoundException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str):
|
||
|
|
super().__init__(f"config not found for plugin: {plugin_id}", plugin_id)
|
||
|
|
|
||
|
|
|
||
|
|
class InvalidPluginStateException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str, current_status: str, target_action: str):
|
||
|
|
super().__init__(
|
||
|
|
f"cannot {target_action} plugin {plugin_id} in {current_status} state",
|
||
|
|
plugin_id,
|
||
|
|
)
|
||
|
|
self.current_status = current_status
|
||
|
|
self.target_action = target_action
|
||
|
|
|
||
|
|
|
||
|
|
class ActiveSessionExistsException(PluginException):
|
||
|
|
def __init__(self, plugin_id: str, channel_type: str, active_count: int):
|
||
|
|
super().__init__(
|
||
|
|
f"channel {channel_type} has {active_count} active sessions, graceful deactivate required",
|
||
|
|
plugin_id,
|
||
|
|
)
|
||
|
|
self.channel_type = channel_type
|
||
|
|
self.active_count = active_count
|