[GRASS-dev] Re: [GRASS-user] Catch errors from grass.mapcalc
    Glynn Clements 
    glynn at gclements.plus.com
       
    Sat Oct 30 10:46:31 EDT 2010
    
    
  
Martin Landa wrote:
> > Beyond that, we should probably think about how to deal with errors in
> > the Python scripting library. I.e. whether to raise Python exceptions,
> > return status codes, call fatal(), etc. Right now, each function does
> > as it pleases; there isn't any consistency.
> 
> r44086 helps a bit?
> 
> error() raise ScriptException() by default. If you call
> raise_on_error(False) then error() prints error message via `g.message
> -e`.
There's still the question of when to generate errors. E.g. should
run_command() just return the exit code or should it generate an error
if the exit code is non-zero? If it raises an exception, the actual
exit code should be retrievable from the exception object.
-- 
Glynn Clements <glynn at gclements.plus.com>
    
    
More information about the grass-dev
mailing list