[py-dev] revising exception handling / help appreciated

Armin Rigo arigo at tunes.org
Sun Jan 2 16:40:17 CET 2005


Hi,

Would some mixed scheme make sense?  Something with some inheritance, for
example:

py.error.PathError
    py.error.NotFound
        py.error.ENOENT
    py.error.PermissionDenied
        py.error.EACCES
        py.error.EPERM

The actual raised exceptions would be the EXXX ones but with an error message 
that gives the readable category:

>>> p = mydir.join('filename').open()
Traceback:
...
py.error.EACCES: Permission Denied

Then programers can catch the precise exception or the broader category (whose
name is obvious from the error message).


A bientot,

Armin.



More information about the Pytest-dev mailing list