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

7 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-12-20 08:07 +0000

1"""Custom exceptions for sparqlite.""" 

2 

3from typing import Optional 

4 

5 

6class SPARQLError(Exception): 

7 """Base exception for all SPARQL-related errors.""" 

8 

9 

10class QueryError(SPARQLError): 

11 """Raised when there is a syntax error in the SPARQL query.""" 

12 

13 

14class EndpointError(SPARQLError): 

15 """Raised when there is an HTTP or connection error with the endpoint.""" 

16 

17 def __init__(self, message: str, status_code: Optional[int] = None): 

18 super().__init__(message) 

19 self.status_code = status_code