diff --git a/python/lsst/consdb/client.py b/python/lsst/consdb/client.py index 602d5ca7..b756a50c 100644 --- a/python/lsst/consdb/client.py +++ b/python/lsst/consdb/client.py @@ -1,6 +1,7 @@ import os from pandas import DataFrame import requests +from requests.exceptions import RequestException from typing import Any, Iterable from urllib.parse import urljoin @@ -15,8 +16,8 @@ def insert(table: str, values: dict[str, Any], **kwargs): url = urljoin(base_url, "insert") try: response = requests.post(url, json=data) - except: - raise + except (RequestException) as e: + raise e response.raise_for_status() @@ -35,8 +36,8 @@ def query( data = {"tables": tables, "columns": columns, "where": where, "join": join} try: response = requests.post(url, json=data) - except: - raise + except (RequestException) as e: + raise e try: response.raise_for_status() except: @@ -51,7 +52,7 @@ def schema(table: str): url = urljoin(url, table) try: response = requests.get(url) - except: - raise + except (RequestException) as e: + raise e response.raise_for_status() return response.json()