Skip to content

Commit b3c16ca

Browse files
committed
Raise Exception if execute_sparql_query() fail instead of None
1 parent 3e2ce9a commit b3c16ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wikibaseintegrator/wbi_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def mediawiki_api_call_helper(data: Dict[str, Any], login: _Login = None, mediaw
201201

202202

203203
@wbi_backoff()
204-
def execute_sparql_query(query: str, prefix: str = None, endpoint: str = None, user_agent: str = None, max_retries: int = 1000, retry_after: int = 60) -> Optional[Dict[str, Dict]]:
204+
def execute_sparql_query(query: str, prefix: str = None, endpoint: str = None, user_agent: str = None, max_retries: int = 1000, retry_after: int = 60) -> Dict[str, Dict]:
205205
"""
206206
Static method which can be used to execute any SPARQL query
207207
@@ -260,7 +260,7 @@ def execute_sparql_query(query: str, prefix: str = None, endpoint: str = None, u
260260

261261
return results
262262

263-
return None
263+
raise Exception(f"No result after {max_retries} retries.")
264264

265265

266266
def merge_items(from_id: str, to_id: str, login: _Login = None, ignore_conflicts: List[str] = None, is_bot: bool = False, **kwargs: Any) -> Dict:

0 commit comments

Comments
 (0)