Coverage for src / sql_tool / core / exceptions.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-14 15:28 -0500
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-14 15:28 -0500
1"""Exception hierarchy for SQL Tool.
3All exceptions carry an exit_code for CLI return value mapping.
4Exit codes are defined in exit_codes.py and follow CODE-PY-CLI-001 pattern.
5"""
7from sql_tool.core.exit_codes import ExitCode
10class SqlToolError(Exception):
11 """Base exception for all SQL Tool errors."""
13 exit_code: int = ExitCode.GENERAL_ERROR
15 def __init__(self, message: str) -> None:
16 self.message = message
17 super().__init__(message)
20class NetworkError(SqlToolError):
21 """Connection failures, unreachable host."""
23 exit_code: int = ExitCode.NETWORK_ERROR
26class TimeoutError(NetworkError):
27 """Query timeout, connection timeout."""
29 exit_code: int = ExitCode.TIMEOUT
32class InputError(SqlToolError):
33 """File not found, invalid parameters."""
35 exit_code: int = ExitCode.INPUT_ERROR
38class ConfigError(SqlToolError):
39 """Malformed config, missing profile."""
41 exit_code: int = ExitCode.CONFIG_ERROR