Coverage for src / beautyspot / exceptions.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.2, created at 2026-03-09 14:39 +0900

1# src/beautyspot/exceptions.py 

2 

3 

4class BeautySpotError(Exception): 

5 """ 

6 Base exception for all beautyspot errors. 

7 ユーザーが `except BeautySpotError:` でライブラリ起因のエラーを 

8 一括キャッチできるようにするための基底クラスです。 

9 """ 

10 

11 

12class CacheCorruptedError(BeautySpotError): 

13 """ 

14 Raised when cache data (DB record or Blob file) is lost, 

15 unreadable, or logically corrupted. 

16 """ 

17 

18 

19class SerializationError(BeautySpotError): 

20 """ 

21 Raised when the serializer fails to encode or decode data. 

22 """ 

23 

24 

25class ConfigurationError(BeautySpotError): 

26 """ 

27 Raised when there is a logical error in the user's configuration 

28 (e.g., invalid retention policy, incompatible storage options). 

29 """ 

30 

31 

32class ValidationError(ConfigurationError, ValueError): 

33 """ 

34 メソッド呼び出し時の引数やバリデーションエラー。 

35 ValueError のサブクラスでもあるため、既存の `except ValueError:` でも捕捉できます。 

36 """ 

37 

38 

39class IncompatibleProviderError(ConfigurationError, ValueError): 

40 """ 

41 注入された依存オブジェクト(Serializer, Storage, DB)が 

42 要求された機能を提供していない場合のエラー。 

43 ValueError のサブクラスでもあるため、既存の `except ValueError:` でも捕捉できます。 

44 """