Coverage for lintro / ai / exceptions.py: 100%
7 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""AI-specific exception hierarchy for Lintro.
3All exceptions inherit from LintroError to maintain a consistent
4exception hierarchy across the project.
5"""
7from __future__ import annotations
9from lintro.exceptions.errors import LintroError
12class AIError(LintroError):
13 """Base exception for all AI-related errors."""
16class AINotAvailableError(AIError):
17 """AI dependencies are not installed.
19 Raised when AI features are requested but the required packages
20 (anthropic, openai) are not available. The error message includes
21 installation instructions.
22 """
25class AIProviderError(AIError):
26 """Error communicating with an AI provider.
28 Raised for general API communication failures such as network
29 errors, server errors, or unexpected response formats.
30 """
33class AIAuthenticationError(AIProviderError):
34 """API key is invalid or missing.
36 Raised when the provider rejects the API key or when no API key
37 can be found in the expected environment variable.
38 """
41class AIRateLimitError(AIProviderError):
42 """Rate limit exceeded on the AI provider.
44 Raised when the provider returns a rate limit error. Users should
45 wait and retry, or switch to a different provider/model.
46 """