Skip to content

grass.temporal: Raise ValueError on invalid spatial relation - #7949

Merged
echoix merged 1 commit into
OSGeo:mainfrom
bhuvan-somisetty:fix-temporal-spatial-relation-raise
Oct 2, 2026
Merged

echoix merged 1 commit into
OSGeo:mainfrom
bhuvan-somisetty:fix-temporal-spatial-relation-raise

Conversation

@bhuvan-somisetty

Copy link
Copy Markdown
Contributor

Description

This PR fixes error handling in _update_where_statement_by_spatial_extent() in python/grass/temporal/abstract_space_time_dataset.py.

Previously, when an unsupported spatial_relation was passed, self.msgr.error(...) was followed by a bare raise statement outside of an except block. This caused Python to raise a RuntimeError: No active exception to reraise.

The method now properly formats the translatable error message and raises a ValueError(msg).

Motivation and context

Fixes #7948

How has this been tested?

  • Verified that calling _update_where_statement_by_spatial_extent() with an invalid relation raises ValueError with the expected error message rather than RuntimeError.
  • Verified valid relations (overlaps, is_contained, contains) generate expected SQL where clauses.
  • Ran ruff check and ruff format --check on the modified file.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • PR title provides summary of the changes and starts with one of the pre-defined prefixes
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

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 OSGeo#7948

Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
@github-actions github-actions Bot added Python Related code is in Python libraries labels Sep 25, 2026
@echoix
echoix merged commit 33d985d into OSGeo:main Oct 2, 2026
26 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] grass.temporal: Bare raise in _update_where_statement_by_spatial_extent raises RuntimeError instead of ValueError

2 participants