Source code for automation_file.exceptions

"""Exception hierarchy for automation_file.

All custom exceptions inherit from ``FileAutomationException`` so callers can
filter with a single ``except`` and still distinguish specific failures.
"""

from __future__ import annotations


[docs] class FileAutomationException(Exception): """Root of the automation_file exception tree."""
[docs] class FileNotExistsException(FileAutomationException): """Raised when a required source file is missing."""
[docs] class DirNotExistsException(FileAutomationException): """Raised when a required directory is missing."""
[docs] class ZipInputException(FileAutomationException): """Raised when a zip helper receives an unsupported input type."""
[docs] class CallbackExecutorException(FileAutomationException): """Raised by ``CallbackExecutor`` for registration / dispatch failures."""
[docs] class ExecuteActionException(FileAutomationException): """Raised by ``ActionExecutor`` when an action list cannot be run."""
[docs] class AddCommandException(FileAutomationException): """Raised when a command registered into the executor is not callable."""
[docs] class JsonActionException(FileAutomationException): """Raised when JSON action files cannot be read or written."""
[docs] class ArgparseException(FileAutomationException): """Raised when the CLI receives no actionable argument."""
[docs] class UrlValidationException(FileAutomationException): """Raised when a URL fails scheme / host validation (SSRF guard)."""
[docs] class ValidationException(FileAutomationException): """Raised when an action list fails pre-execution validation."""
[docs] class RetryExhaustedException(FileAutomationException): """Raised when a ``@retry_on_transient`` wrapped call runs out of attempts."""
[docs] class QuotaExceededException(FileAutomationException): """Raised when an action exceeds a configured size or duration quota."""
[docs] class PathTraversalException(FileAutomationException): """Raised when a user-supplied path escapes the allowed root."""
[docs] class TCPAuthException(FileAutomationException): """Raised when a TCP client fails shared-secret authentication."""
[docs] class DagException(FileAutomationException): """Raised when a DAG action list has a cycle, unknown dep, or duplicate id."""
[docs] class RateLimitExceededException(FileAutomationException): """Raised when a rate-limited call cannot acquire a token in the allotted wait."""
[docs] class CircuitOpenException(FileAutomationException): """Raised when a circuit breaker is open and short-circuits the protected call."""
[docs] class LockTimeoutException(FileAutomationException): """Raised when a lock acquire waits past its timeout."""
[docs] class QueueException(FileAutomationException): """Raised by the persistent action queue on storage / dispatch errors."""
[docs] class CASException(FileAutomationException): """Raised by the content-addressable store on integrity / I/O failures."""
[docs] class TemplateException(FileAutomationException): """Raised when template rendering fails (missing engine, syntax, I/O)."""
[docs] class DiffException(FileAutomationException): """Raised when diff computation or patch application fails."""
[docs] class VersioningException(FileAutomationException): """Raised by the versioning helpers on retention / I/O failures."""
[docs] class ArchiveException(FileAutomationException): """Raised when an archive format is unsupported or extraction fails."""
[docs] class WebDAVException(FileAutomationException): """Raised by the WebDAV client on transport / protocol failures."""
[docs] class SMBException(FileAutomationException): """Raised by the SMB/CIFS client on connection / protocol failures."""
[docs] class MCPServerException(FileAutomationException): """Raised by the MCP server bridge when a tool invocation fails."""
[docs] class FsspecException(FileAutomationException): """Raised by the fsspec bridge on missing dependency or backend failures."""
[docs] class TextOpsException(FileAutomationException): """Raised by text / binary file helpers (split, merge, sed, encoding_convert)."""
[docs] class DataOpsException(FileAutomationException): """Raised by CSV / JSONL / YAML / Parquet helpers."""
[docs] class OneDriveException(FileAutomationException): """Raised by the OneDrive (Microsoft Graph) backend."""
[docs] class BoxException(FileAutomationException): """Raised by the Box backend."""
[docs] class TracingException(FileAutomationException): """Raised when OpenTelemetry tracing setup cannot be completed."""
_ARGPARSE_EMPTY_MESSAGE = "argparse received no actionable argument" _BAD_TRIGGER_FUNCTION = "trigger name is not registered in the executor" _BAD_CALLBACK_METHOD = "callback_param_method must be 'kwargs' or 'args'" _ADD_COMMAND_NOT_CALLABLE = "command value must be a callable" _ACTION_LIST_EMPTY = "action list is empty or wrong type" _ACTION_LIST_MISSING_KEY = "action dict missing 'auto_control' key" _CANT_FIND_JSON = "can't read JSON file" _CANT_SAVE_JSON = "can't write JSON file"