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

Glynn Clements glynn.clements at virgin.net
Tue Oct 22 08:11:51 EDT 2002


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.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list