[GRASS-dev] Unify python GRASS defined exception in one common file

Luca Delucchi lucadeluge at gmail.com
Thu Jul 3 23:53:39 PDT 2014


On 3 July 2014 17:35, Pietro <peter.zamb at gmail.com> wrote:
> Dear devs,
>

Hi,

> What do you think if we unify all our custom exceptions in one common file?
> Just to avoid code repetitions and help consistency.
>
> Looking into the code I found the following custom exceptions:
>
> {{{
> $ grep --color=auto
> --exclude-dir={.svn,.git,.OBJ,locale,dist.x86_64-unknown-linux-gnu}
> -IrnE "class\s\w+\(Exception\)\:"
> lib/python/pygrass/messages/__init__.py:21:class FatalError(Exception):
> lib/python/pygrass/errors.py:11:class AbstractError(Exception):
> lib/python/pygrass/errors.py:19:class ParameterError(Exception):
> lib/python/pygrass/errors.py:23:class FlagError(Exception):
> lib/python/pydispatch/errors.py:4:class DispatcherError(Exception):
> lib/python/temporal/abstract_dataset.py:26:class ImplementationError(Exception):
> lib/python/temporal/temporal_algebra.py:655:class FatalError(Exception):
> lib/python/ctypes/ctypesgencore/parser/lex.py:46:class LexError(Exception):
> lib/python/ctypes/ctypesgencore/parser/yacc.py:87:class
> YaccError(Exception):   pass
> lib/python/script/core.py:50:class ScriptError(Exception):
> gui/wxpython/core/gcmd.py:156:class GException(Exception):
> gui/wxpython/wxgui.py:86:class Usage(Exception):
> }}}
>
> Perhaps we could create a new file in grass.script.errors or
> grass.script.exceptions, or outside script so something like
> grass.errors or grass.exceptions.
>
> Do you think it is a bad idea?
>

If it is possible without create problems I think it is a good idea...

> Best regards
>
> Pietro
>

-- 
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org


More information about the grass-dev mailing list