Skip to content

Commit

Permalink
Fix missing framelike data parsing error handling for generic rest ad…
Browse files Browse the repository at this point in the history
…apter data fetching
  • Loading branch information
stewit committed Dec 18, 2024
1 parent 1209d46 commit fee3e8a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions runtime/hetdesrun/adapters/generic_rest/load_framelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def are_valid_sources(filtered_sources: list[FilteredSource]) -> tuple[bool, str
return True, ""


async def load_framelike_data( # noqa: PLR0915
async def load_framelike_data( # noqa: PLR0915,PLR0912
filtered_sources: list[FilteredSource],
additional_params: list[
tuple[str, str]
Expand Down Expand Up @@ -152,7 +152,14 @@ async def load_framelike_data( # noqa: PLR0915
raise AdapterConnectionError(msg)
logger.info("Start reading in and parsing framelike data")

df: pd.DataFrame = pd.read_json(resp.raw, lines=True)
try:
df: pd.DataFrame = pd.read_json(resp.raw, lines=True)
except Exception as e:
msg = (
f"Could not parse framelike response data from {url} via pd.read_json"
f" Exception was:\n{str(e)}."
)
raise AdapterHandlingException(msg) from e
end_time = datetime.datetime.now(datetime.timezone.utc)
logger.info(
(
Expand Down

0 comments on commit fee3e8a

Please sign in to comment.