[py-dev] revising exception handling / help appreciated

Laura Creighton lac at strakt.com
Sun Jan 2 16:22:01 CET 2005


What about a scheme:

<snip>
    try:
        do_something_with(path)
    except py.error.NotFound: #ENOENT
       ...
    except py.error.PermissionDenied: #EPERM
       ...
</snip>

>OTOH, it's harder to guess the exact meaning of these "nice" names. 
>It at least causes thinking and documentation effort. Whereas
>with "errno-classes" we can say: google luckily, since these weird 
>abbreviations are easily found as the first hit.  Note e.g. that 
>PermissionDenied may mean either "EACCES" or "EPERM", see e.g. 
>http://www.wlug.org.nz/EPERM for the difference.  

The place we need to spend the effort is on the error message that is seen
when the user has an error.  Whose messages will our users be seeing?
If they all look like this:

http://docs.python.org/lib/module-errno.html

then using Google will be mandatory for figuring out what your program isn't
doing.  I'd rather save our users this time.

Laura



More information about the Pytest-dev mailing list