From 06307aa5091c4037f14b5b8af76bb3698e4aa9df Mon Sep 17 00:00:00 2001 From: Ashley Sommer Date: Wed, 28 Aug 2024 16:02:26 +1000 Subject: [PATCH] Emit an early error when a RemoeSparqlRepo is configured, but SPARQL_ENDPOINT is not provided in the settings file or the env var. (#262) --- prez/repositories/remote_sparql.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prez/repositories/remote_sparql.py b/prez/repositories/remote_sparql.py index 5053d268..47bd3148 100755 --- a/prez/repositories/remote_sparql.py +++ b/prez/repositories/remote_sparql.py @@ -15,6 +15,12 @@ class RemoteSparqlRepo(Repo): def __init__(self, async_client: httpx.AsyncClient): self.async_client = async_client + if not settings.sparql_endpoint: + raise ValueError( + "When using a remote SPARQL endpoint, " + "the SPARQL_ENDPOINT setting must be set using either " + "the environment variable or the config file." + ) async def _send_query(self, query: str, mediatype="text/turtle"): """Sends a SPARQL query asynchronously.