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
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:
42
configforge/exceptions.py
Normal file
42
configforge/exceptions.py
Normal 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
|
||||
Reference in New Issue
Block a user