Files
shopdb-flask/shopdb/exceptions.py
Cam Proudlock a9d0dfff4a Initial import: shopdb-flask multi-site asset platform
Flask + Vue rewrite of the classic-ASP shopdb, built as a plugin
framework so sister GE Aerospace sites can adopt it. Product version
0.7.0-pre-0.8.0, plugin contract 0.11.0, 966 backend tests.

Key entry points:
- docs/INSTALL-WINDOWS-IIS.md - tested Windows + IIS install runbook
  (own-site and subpath deployment methods)
- docs/PILOT-DEPLOY.md - production pilot: stand up + import + verify
- docs/IMPORT-API.md - schema-agnostic legacy data import contract
- scripts/site_imports/wjf/ - West Jefferson reference import loader
- docs/adr/ - twelve accepted architecture decision records
2026-07-14 07:58:51 -04:00

71 lines
2.0 KiB
Python

"""Custom exceptions for ShopDB."""
class ShopDBException(Exception):
"""Base exception for ShopDB."""
def __init__(self, message: str, code: str = None, details: dict = None):
super().__init__(message)
self.message = message
self.code = code or 'SHOPDB_ERROR'
self.details = details or {}
class ValidationError(ShopDBException):
"""Validation error."""
def __init__(self, message: str, details: dict = None):
super().__init__(message, 'VALIDATION_ERROR', details)
class NotFoundError(ShopDBException):
"""Resource not found error."""
def __init__(self, resource: str, identifier):
message = f"{resource} with ID {identifier} not found"
super().__init__(message, 'NOT_FOUND', {'resource': resource, 'id': identifier})
class AuthenticationError(ShopDBException):
"""Authentication error."""
def __init__(self, message: str = "Authentication required"):
super().__init__(message, 'UNAUTHORIZED')
class AuthorizationError(ShopDBException):
"""Authorization error."""
def __init__(self, message: str = "Permission denied"):
super().__init__(message, 'FORBIDDEN')
class ConflictError(ShopDBException):
"""Conflict error (e.g., duplicate entry)."""
def __init__(self, message: str, details: dict = None):
super().__init__(message, 'CONFLICT', details)
class PluginError(ShopDBException):
"""Plugin-related error."""
def __init__(self, message: str, plugin_name: str = None):
super().__init__(message, 'PLUGIN_ERROR', {'plugin': plugin_name})
class PluginNotFoundError(PluginError):
"""A plugin directory or manifest is missing."""
class PluginContractError(PluginError):
"""A plugin violates the BasePlugin contract (no subclass, missing hooks)."""
class PluginVersionError(PluginError):
"""A plugin's core_version range does not include the framework's __contract_version__."""
class PluginDependencyError(PluginError):
"""A plugin declares a dependency on another plugin that is missing or not enabled."""