Coverage for src / sparqlite / exceptions.py: 100%
7 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-03-21 11:59 +0000
« prev ^ index » next coverage.py v7.12.0, created at 2026-03-21 11:59 +0000
1# SPDX-FileCopyrightText: 2025 Arcangelo Massari <arcangelo.massari@unibo.it>
2#
3# SPDX-License-Identifier: ISC
5"""Custom exceptions for sparqlite."""
7from typing import Optional
10class SPARQLError(Exception):
11 """Base exception for all SPARQL-related errors."""
14class QueryError(SPARQLError):
15 """Raised when there is a syntax error in the SPARQL query."""
18class EndpointError(SPARQLError):
19 """Raised when there is an HTTP or connection error with the endpoint."""
21 def __init__(self, message: str, status_code: Optional[int] = None):
22 super().__init__(message)
23 self.status_code = status_code