Antoine Pitrou wrote:

> Why do you want to derive program bugs from EnvironmentError ? Usually I 
> derive
> them from ValueError, RuntimeError or simply Exception.

I'm *not* talking about program bugs, I'm talking about
exceptions due to something the user did wrong.

I like to be able to do this:

   try:
     f = open(somefile)
     mungulate(f)
     f.close()
   except EnvironmentError, e:
     big_nasty_alert("Couldn't mungulate: %s" % e)

I *don't* want this to catch things like TypeError and
ValueError that indicate a program bug if they ever
escape. I want those to propagate and cause a traceback
or get handled at a higher level.

By deriving my own external-factors exceptions from
EnvironmentError, this all works very nicely.

 From its position in the exception hierarchy, this
seems to be just the sort of thing that EnvironmentError
is designed for, and I'm perplexed to be told that
it's not.

-- 
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to