From b50a95cf81fe2bb015e1c499ff32f935fdf5a15e Mon Sep 17 00:00:00 2001 From: bhuvan-somisetty Date: Fri, 25 Sep 2026 12:23:56 +0530 Subject: [PATCH] grass.temporal: Raise ValueError on invalid spatial relation In _update_where_statement_by_spatial_extent(), raise a ValueError with the formatted error message instead of executing a bare raise outside an except block, which was causing a RuntimeError ("No active exception to reraise"). Also fix whitespace introduced by backslash continuation. Fixes #7948 Signed-off-by: bhuvan-somisetty --- .../grass/temporal/abstract_space_time_dataset.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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 += ""