[GRASS5] gis lib: write error function (put_row.c)

Eric G. Miller egm2 at jps.net
Tue Oct 22 10:28:54 EDT 2002


On Tue, Oct 22, 2002 at 01:11:51PM +0100, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > while having the problem that a disk run out of space
> > while using r.in.gdal, I found that
> > 
> > write_error()
> > in src/libes/gis/put_row.c
> > just contains G_warning() and not G_fatal_error().
> > 
> > Are there objections to change this to 
> > G_fatal_error("...unable to write row...")
> > ?
> > 
> > It doesn't make much sense to continue writing to a full disk.
> 
> Writes could theoretically fail for reasons other than a full disk,
> although I can't actually think of anything which would be
> recoverable.
> 
> If you change write_error() to call G_fatal_error(), I suggest
> changing the calling functions to return "void" rather than a status
> value. That way, if anything was actually checking the return value
> and attempting recovery, you'll get compilation errors alerting you to
> the fact.
> 
> In all probability, it should just call G_fatal_error(). If there are
> specific cases which actually want to handle the error, they can use
> G_set_error_routine().
> 
> More generally, library functions which only rarely fail should just
> call G_fatal_error() IMHO, rather than returning an error status and
> thereby passing the responsibility to the individual modules.

If you change G_put_raster_row(), et al. to return void, then it isn't
very easy to tell where the error came from.  I thought folks wanted
to get G_fatal_error() out of library functions...

-- 
static const char signature[] = 
	"Copyright (c) 2002 Eric G. Miller <egm2 at jps.net>";




More information about the grass-dev mailing list