Skip to content

Commit

Permalink
Updated error message
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Jul 18, 2022
1 parent b06424c commit d933eac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion geoviews/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def test_outside_extents():

msg = (
"Could not project data from .+? projection to .+? projection\. "
"Ensure the coordinate reference system \(crs\) matches your data and the kdims\."
"Ensure the coordinate reference system \(CRS\) matches your data and the kdims, "
"and the data is not ouside the bounds of the CRS."
)
with pytest.raises(ValueError, match=msg):
project_extents(extents, src_proj, dest_proj)
15 changes: 8 additions & 7 deletions geoviews/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ def project_extents(extents, src_proj, dest_proj, tol=1e-6):
try:
geom_in_crs = dest_proj.project_geometry(geom_in_src_proj, src_proj)
except (ValueError, IndexError):
src_name =type(src_proj).__name__
dest_name =type(dest_proj).__name__
raise ValueError('Could not project data from %s projection '
'to %s projection. Ensure the coordinate '
'reference system (crs) matches your data '
'and the kdims.' %
(src_name, dest_name)) from None
src_name = type(src_proj).__name__
dest_name = type(dest_proj).__name__
raise ValueError(
f'Could not project data from {src_name} projection '
f'to {dest_name} projection. Ensure the coordinate '
'reference system (CRS) matches your data and the kdims, '
'and the data is not ouside the bounds of the CRS.'
) from None
else:
geom_in_crs = boundary_poly.intersection(domain_in_src_proj)
return geom_in_crs.bounds
Expand Down

0 comments on commit d933eac

Please sign in to comment.