[GRASS-dev] [GRASS GIS] #3828: pygrass.gis.Region.from_* should raise a ValueError if the specified map does not exist.

#3828: pygrass.gis.Region.from_* should raise a ValueError if the specified map
does not exist.
-------------------------+-------------------------
Reporter: pmav99 | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone:
Component: PyGRASS | Version: svn-trunk
Keywords: | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
I think it would be better if
{{{
pygrass.gis.Region.from_rast(raster_name)
pygrass.gis.Region.from_vect(vector_name)
}}}

would raise a {{{ValueError}}} if the specified map name cannot be found.
With the current implementation, the region remains unchanged and you have
no clue about that:
https://grass.osgeo.org/grass77/manuals/libpython/_modules/pygrass/gis/region.html#Region.from_rast

Note, it might make sense to raise the Exception from within
{{{get_mapset_raster()}}} but that function is used in more places and I
haven't checked if this will break anything.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3828&gt;
GRASS GIS <https://grass.osgeo.org>

#3828: pygrass.gis.Region.from_* should raise a ValueError if the specified map
does not exist.
--------------------------+-------------------------
  Reporter: pmav99 | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone:
Component: PyGRASS | Version: svn-trunk
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by neteler):

A patch would be appreciated.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3828#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>