Coverage for projects/04-llm-adapter-shadow/src/llm_adapter/errors.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-09-24 01:32 +0000

1"""Error hierarchy for the minimal LLM adapter.""" 

2 

3from __future__ import annotations 

4 

5 

6class AdapterError(Exception): 

7 """Base class for errors originating from providers or the adapter.""" 

8 

9 

10class TimeoutError(AdapterError): 

11 """Raised when a provider does not respond within the expected window.""" 

12 

13 

14class RateLimitError(AdapterError): 

15 """Raised when a provider rejects the request due to rate limiting.""" 

16 

17 

18class AuthError(AdapterError): 

19 """Raised when credentials are missing or invalid for the provider.""" 

20 

21 

22class RetriableError(AdapterError): 

23 """Raised for transient issues where retrying with another provider may help.""" 

24 

25 

26class FatalError(AdapterError): 

27 """Raised for unrecoverable issues that should halt the runner.""" 

28 

29 

30__all__ = [ 

31 "AdapterError", 

32 "TimeoutError", 

33 "RateLimitError", 

34 "AuthError", 

35 "RetriableError", 

36 "FatalError", 

37]