Skip to content

Commit e3d7b93

Browse files
fix worldbank fallback by raising a ValueError instead of a RuntimeError
1 parent 4d2d690 commit e3d7b93

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

climada/test/test_litpop_integr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def test_netherlands150_pass(self):
5353
self.assertEqual(ent.gdf.shape[0], 2829)
5454

5555
def test_BLM150_pass(self):
56-
"""Test from_countries for BLM at 150 arcsec, 2 data points"""
56+
"""Test from_countries for BLM at 150 arcsec, 2 data points
57+
The world bank doesn't provide data for Saint Barthélemy, fall back to natearth
58+
"""
5759
ent = lp.LitPop.from_countries("BLM", res_arcsec=150, reference_year=2016)
5860
self.assertEqual(ent.gdf.shape[0], 2)
5961

climada/util/finance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def download_world_bank_indicator(
216216
# Check if we received an error message
217217
try:
218218
if json_data[0]["message"][0]["id"] == "120":
219-
raise RuntimeError(
219+
raise ValueError(
220220
"Error requesting data from the World Bank API. Did you use the "
221221
"correct country code and indicator ID?"
222222
)

0 commit comments

Comments
 (0)