diff --git a/python/grass/temporal/abstract_space_time_dataset.py b/python/grass/temporal/abstract_space_time_dataset.py index 1b135d52a2f..576b261281e 100644 --- a/python/grass/temporal/abstract_space_time_dataset.py +++ b/python/grass/temporal/abstract_space_time_dataset.py @@ -1765,14 +1765,12 @@ def _update_where_statement_by_spatial_extent( if not spatial_relation: spatial_relation = "overlaps" elif spatial_relation not in {"overlaps", "is_contained", "contains"}: - self.msgr.error( - _( - "Invalid spatial relation <{}> requested." - "Only values 'overlaps', 'is_contained', and 'contains' are \ - allowed." - ).format(spatial_relation) - ) - raise + msg = _( + "Invalid spatial relation <{}> requested. " + "Only values 'overlaps', 'is_contained', and 'contains' are allowed." + ).format(spatial_relation) + self.msgr.error(msg) + raise ValueError(msg) # SQL implementation of overlap, is_contained, and contains where += ""