aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-05-21 14:13:26 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-05-21 14:17:26 +0200
commit41118a39c0123505487b43697fa411df33467b90 (patch)
tree3c94551520b55ddfcc15eefe7c380383f5aeb136
parent12bd18ed5e01a84b03be7c21570bac6547759970 (diff)
common_gdal: Replace remaining generic Exception with RuntimeError.
-rw-r--r--common_gdal.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/common_gdal.py b/common_gdal.py
index 17ed1bc..4fea54a 100644
--- a/common_gdal.py
+++ b/common_gdal.py
@@ -67,11 +67,9 @@ def gdalSetOpenExArgs(option_dict : Optional[dict[str, Any]] = {},
else:
drv = gdal.GetDriverByName(fmt)
if drv is None:
- # pylint: disable-next=broad-exception-raised
- raise Exception(f'Unknown driver name "{fmt}"')
+ raise RuntimeError(f'Unknown driver name "{fmt}"')
if not gdalGetMetadataItem(drv, gdal.DCAP_VECTOR):
- # pylint: disable-next=broad-exception-raised
- raise Exception(f'Driver "{drv.ShortName}" has no vector capabilities')
+ raise RuntimeError(f'Driver "{drv.ShortName}" has no vector capabilities')
kwargs['allowed_drivers'] = [ drv.ShortName ]
oo = option_dict.get('open-options', None)
@@ -90,8 +88,7 @@ def getSRS(srs_str : Optional[str]) -> osr.SpatialReference:
code = int(srs_str.removeprefix('EPSG:'))
srs.ImportFromEPSG(code)
else:
- # pylint: disable-next=broad-exception-raised
- raise Exception(f'Unknown SRS {srs_str}')
+ raise RuntimeError(f'Unknown SRS {srs_str}')
logging.debug('Default SRS: "%s" (%s)', srs.ExportToProj4(), srs.GetName())
return srs
@@ -108,11 +105,9 @@ def getExtent(extent : Optional[tuple[float, float, float, float]],
return None, None
if not isinstance(extent, tuple) or len(extent) != 4:
- # pylint: disable-next=broad-exception-raised
- raise Exception(f'Invalid extent {extent}')
+ raise RuntimeError(f'Invalid extent {extent}')
if srs is None:
- # pylint: disable-next=broad-exception-raised
- raise Exception('Configured extent but no SRS')
+ raise RuntimeError('Configured extent but no SRS')
logging.debug('Configured extent in %s: %s', srs.GetName(),
', '.join(map(str, extent)))