Describe the bug
xrspatial/geotiff/_vrt.py:353-375 wraps each source read in except Exception. Strict mode (XRSPATIAL_GEOTIFF_STRICT=1, from #1662) re-raises, but the default warns and continues for any exception subclass, including RuntimeError, MemoryError, and anything thrown by code paths that were not envisioned when the catch was written.
The intent is "the source file is unreadable, fall back to fill values." The implementation is "swallow everything the read can throw, including bugs."
Expected behavior
A RuntimeError("synthetic") raised from a stub inside read_to_array should propagate out of read_vrt, not warn-and-continue.
Suggested fix
Replace except Exception with except (OSError, ValueError, struct.error) (or whatever subset matches the documented recoverable error set for read_to_array). Keep the strict-mode raise and the existing warning text.
Add a test that monkeypatches read_to_array to raise RuntimeError and asserts read_vrt propagates rather than warns.
Additional context
Reported during a code review of the geotiff module. Related to the strict-mode work in #1662 / commit 033b6a2.
Describe the bug
xrspatial/geotiff/_vrt.py:353-375wraps each source read inexcept Exception. Strict mode (XRSPATIAL_GEOTIFF_STRICT=1, from #1662) re-raises, but the default warns and continues for any exception subclass, includingRuntimeError,MemoryError, and anything thrown by code paths that were not envisioned when the catch was written.The intent is "the source file is unreadable, fall back to fill values." The implementation is "swallow everything the read can throw, including bugs."
Expected behavior
A
RuntimeError("synthetic")raised from a stub insideread_to_arrayshould propagate out ofread_vrt, not warn-and-continue.Suggested fix
Replace
except Exceptionwithexcept (OSError, ValueError, struct.error)(or whatever subset matches the documented recoverable error set forread_to_array). Keep the strict-moderaiseand the existing warning text.Add a test that monkeypatches
read_to_arrayto raiseRuntimeErrorand assertsread_vrtpropagates rather than warns.Additional context
Reported during a code review of the geotiff module. Related to the strict-mode work in #1662 / commit 033b6a2.