Coverage for sdks / stigmem-py / src / stigmem / exceptions.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-05-25 01:49 +0000

1"""Stigmem client exceptions.""" 

2 

3from __future__ import annotations 

4 

5 

6class StigmemError(Exception): 

7 """Base exception for all stigmem client errors.""" 

8 

9 

10class StigmemHTTPError(StigmemError): 

11 """An HTTP error response from the stigmem node.""" 

12 

13 def __init__(self, status_code: int, detail: str) -> None: 

14 super().__init__(f"HTTP {status_code}: {detail}") 

15 self.status_code = status_code 

16 self.detail = detail 

17 

18 

19class StigmemAuthError(StigmemHTTPError): 

20 """401/403 from the node.""" 

21 

22 

23class StigmemNotFoundError(StigmemHTTPError): 

24 """404 from the node.""" 

25 

26 

27class StigmemConflictError(StigmemHTTPError): 

28 """409 from the node (e.g. duplicate peer)."""