Skip to content

Commit ee7474d

Browse files
committed
use Timeout instead of Exception
1 parent 9906815 commit ee7474d

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

pvlib/iotools/ecmwf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def get_era5(latitude, longitude, start, end, variables, api_key,
154154

155155
num_polls += 1
156156
if num_polls * poll_interval > timeout:
157-
raise Exception(
157+
raise requests.exceptions.Timeout(
158158
'Request timed out. Try increasing the timeout parameter or '
159159
'reducing the request size.'
160160
)

tests/iotools/test_ecmwf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pandas as pd
66
import pytest
77
import pvlib
8+
import requests
89
import os
910
from tests.conftest import RERUNS, RERUNS_DELAY, requires_ecmwf_credentials
1011

@@ -76,5 +77,5 @@ def test_get_era5_error(params):
7677
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
7778
def test_get_era5_timeout(params):
7879
match = 'Request timed out. Try increasing'
79-
with pytest.raises(Exception, match=match):
80+
with pytest.raises(requests.exceptions.Timeout, match=match):
8081
df, meta = pvlib.iotools.get_era5(**params, timeout=1)

0 commit comments

Comments
 (0)