diff --git a/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py b/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py index a5617c434591..361731a2a549 100644 --- a/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py +++ b/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py @@ -80,7 +80,6 @@ async def aextract_data( yield_curve_type=query.yield_curve_type, ) YIELD_CURVE = IDS["SERIES_IDS"] - MATURITIES = IDS["MATURITIES"] maturities = list(MATURITIES.keys()) @@ -103,8 +102,10 @@ async def get_one(maturity, use_cache): await session.close() else: response = await amake_request(url=url) + if not response: + raise RuntimeError("Error: No data was returned.") if isinstance(response, List): - for item in response: + for item in response: # pylint: disable=E0606 d = { "date": item.get("PERIOD"), "maturity": maturity, diff --git a/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py b/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py index 33cab6d1a584..8b9bfcf15307 100644 --- a/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py +++ b/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py @@ -102,9 +102,10 @@ async def aextract_data( # pylint: disable=R0914.R0912,R0915 response = await helpers.amake_request( # type: ignore url, timeout=20, **kwargs ) - - data = response.get("results") - if not response.get("results"): + if not response: + raise RuntimeError("Error: No data was returned.") + data = response.get("results") # pylint: disable=E0606 + if not data: raise EmptyDataError("The response was returned empty.") return data