On Wed, Jun 25, 2008 at 2:13 PM, johnf <[EMAIL PROTECTED]> wrote:
> On Wednesday 25 June 2008 01:08:58 pm Ed Leafe wrote:
>>         I hereby propose that a new coding standard be adopted in Dabo: no
>>   bare except: statements allowed. Evert try has to catch specific
>> exceptions, or, if the potential exception is unknown (such as when
>> replacing them in very old code), the except catches StandardError and
>> writes it to dabo.errorLog.
>
> Would you provide some coding examples.  I think I understand - but seeing the
> wrong along with the right would make things a little clearer.

How about the one I just fixed?

try:
   self.__src = eval(ds)
except:
   pass

If the eval fails and throws an error, you never know about.  It just
continues on and the user is left wondering why things aren't working
the way they are supposed to.  Now, change that to the following:

try:
   self.__src = eval(ds)
except StandardError:
    dabo.errorLog.write("Couldn't evaluate DataSource '%s'" % ds)

Now there is a written log for it and a starting place to hunt this
down.  You should be able to find the error somewhat easily now.  A
little information is many many many times better that suppressing it
and ignoring it.

Nate L.


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to