Skip to content

Commit

Permalink
Add specialised exception
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusuMET committed Nov 12, 2024
1 parent 052051a commit e2a8f52
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pyaro_readers/eeareader/EEATimeseriesReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
logger = logging.getLogger(__name__)


class EEAReaderException(Exception):
pass


class EEAData(Data):
def __init__(self, data, variable: str) -> None:
self._data = data
Expand All @@ -30,7 +34,7 @@ def __init__(self, data, variable: str) -> None:
def units(self) -> str:
units = self._data["Unit"].unique()
if len(units) != 1:
raise Exception("Multiple different units present in this dataset")
raise EEAReaderException("Multiple different units present in this dataset")
return units[0]

def keys(self):
Expand Down Expand Up @@ -258,7 +262,7 @@ def _read(
polars.col("Notation").eq(variable)
)
if len(pollutant_candidates) == 0:
raise Exception(f"No variable ID found for {variable}")
raise EEAReaderException(f"No variable ID found for {variable}")
variable_id = pollutant_candidates["Id"][0]

filters = _transform_filters(self._filters, variable_id)
Expand Down

0 comments on commit e2a8f52

Please sign in to comment.