[GRASS-dev] catch 2nd question (was gis.m crashes on zoom-out)

Glynn Clements glynn at gclements.plus.com
Sun Apr 29 17:56:11 EDT 2007

Michael Barton wrote:

> There is a lot of open/close syntax in georect.tcl *without* catch
> statements for error trapping.
> Generally, I've added these only where there is a likelihood of a problem.
> Is it a good idea to add catch to *all* open and close statements? to *all*
> close statements, regardless of whether the open statement has a catch? only
> to ones likely to cause a crash?

It's preferable to add a catch to all open and close statements. Or,
at least, to catch the error somewhere; you could could place a catch
around the entire open/read/close operation.

AFAICT, the only likely reason for the open to fail is if the
executable doesn't exist. Any errors which occur after that (including
problems with shared libraries) will be reported by the corresponding
close statement.

The only case where an error running an individual command should
terminate gis.m itself is if gis.m can't reasonably continue to
operate. Problems with retrieving the current region using g.region
might fall into this category.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list