Coverage for src / lexigram / contracts / admin / errors.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-15 18:58 +0800

1"""Admin contract errors — base exceptions for the admin domain. 

2 

3Leaf exceptions live in lexigram-admin, not here. Admin errors are returned as 

4frozen dataclass values in Result.Err(), not raised as exceptions. 

5""" 

6 

7from __future__ import annotations 

8 

9from dataclasses import dataclass 

10 

11from lexigram.contracts.exceptions.base import LexigramError 

12 

13 

14class AdminError(LexigramError): 

15 """Base exception for all admin-domain errors. 

16 

17 Extended by leaf exceptions in lexigram-admin. 

18 """ 

19 

20 _code = "LEX_ERR_ADMIN_001" 

21 

22 

23@dataclass(frozen=True, slots=True) 

24class WidgetNotFoundError: 

25 """Returned as ``Err(WidgetNotFoundError(...))`` when a contributor 

26 cannot render a requested widget. 

27 

28 Frozen immutable value type for use as error payload in Result.Err(). 

29 """ 

30 

31 contributor_name: str 

32 widget_name: str 

33 

34 

35@dataclass(frozen=True, slots=True) 

36class HealthCheckNotFoundError: 

37 """Returned as ``Err(HealthCheckNotFoundError(...))`` when a contributor 

38 cannot execute a requested health check. 

39 

40 Frozen immutable value type for use as error payload in Result.Err(). 

41 """ 

42 

43 contributor_name: str 

44 check_name: str 

45 

46 

47__all__ = [ 

48 "AdminError", 

49 "HealthCheckNotFoundError", 

50 "WidgetNotFoundError", 

51]