Add commands and formatters modules
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.8) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / build-package (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled

This commit is contained in:
2026-01-29 10:49:04 +00:00
parent 406c0d2246
commit b3e312f816

42
configforge/exceptions.py Normal file
View File

@@ -0,0 +1,42 @@
"""Custom exceptions for ConfigForge."""
from typing import Any, Dict, Optional
class ConfigForgeError(Exception):
"""Base exception for ConfigForge errors."""
def __init__(self, message: str, details: Optional[Dict[str, Any]] = None):
super().__init__(message)
self.message = message
self.details = details if details is not None else {}
class InvalidConfigFormatError(ConfigForgeError):
"""Raised when a configuration file has an invalid format."""
pass
class SchemaValidationError(ConfigForgeError):
"""Raised when schema validation fails."""
def __init__(self, message: str, path: str = "", line: Optional[int] = None, details: Optional[Dict[str, Any]] = None):
super().__init__(message, details)
self.path = path if path else ""
self.line = line
class ConversionError(ConfigForgeError):
"""Raised when file format conversion fails."""
pass
class FileOperationError(ConfigForgeError):
"""Raised when file I/O operations fail."""
def __init__(self, message: str, filepath: str = "", details: Optional[Dict[str, Any]] = None):
super().__init__(message, details)
self.filepath = filepath if filepath else ""
class SchemaGenerationError(ConfigForgeError):
"""Raised when schema generation fails."""
pass