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

Pietro peter.zamb at gmail.com
Tue Jul 8 00:18:02 PDT 2014


Hi Vaclav,

On Mon, Jul 7, 2014 at 2:57 PM, Vaclav Petras <wenzeslaus at gmail.com> wrote:
> On Thu, Jul 3, 2014 at 11:35 AM, Pietro <peter.zamb at gmail.com> wrote:
>> What do you think if we unify all our custom exceptions in one common
>> file? [snip]
>> 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):
>> }}}
>>

> However, some of them should stay where they are. [snip]

ok, so I'm going to move to grass.exceptions the following definitions:

- lib/python/pygrass/messages/__init__.py:21:class FatalError(Exception):
- lib/python/pygrass/errors.py:19:class ParameterError(Exception):
- lib/python/pygrass/errors.py:23:class FlagError(Exception):
- lib/python/temporal/abstract_dataset.py:26:class
ImplementationError(Exception):
- lib/python/temporal/temporal_algebra.py:655:class FatalError(Exception):
- lib/python/script/core.py:50:class ScriptError(Exception):
- gui/wxpython/wxgui.py:86:class Usage(Exception):

so these exceptions will stay where they are:

- lib/python/pydispatch/errors.py:4:class DispatcherError(Exception):
- lib/python/ctypes/ctypesgencore/parser/lex.py:46:class LexError(Exception):
- lib/python/ctypes/ctypesgencore/parser/yacc.py:87:class YaccError(Exception):
- gui/wxpython/core/gcmd.py:156:class GException(Exception):


Any concern?

Pietro


More information about the grass-dev mailing list