[Zope] List of Error Tyrpes

Tino Wildenhain tino@wildenhain.de
Thu, 26 Jul 2001 23:20:26 +0200


Hi Tommy,


--On Donnerstag, 26. Juli 2001 11:45 -0800 Tommy Johnson <tommy@7x.com> 
wrote:

> Hey all,
>
> I'm looking for a list of error types. In particular, I'm trying to find
> an error type that pertains to an empty sequence list. My app runs great
> when searching for names within a list, but let's say a user tries to
> find all names that start with 'Z'. Currently, there aren't any names
> that fit that search criteria.

There is no Exception for an empty list. A list continues to be a list,
even when it has no elements.

If you get an error looping over non sequence, you dont have a sequence
object (or - if you are using dtml it could be a string which is normally
a sequence too but for security reasons not for dtml-in)

If you get the value from a form, try <input type="text" 
name="valuename:list">
The :list makes a list even if there is only one element in the form.


> So, I have everything wrapped in a dtml-try. But the error_type that is
> returned is TypeError. The error_value is loop over non-sequence
>
> My question - there probably are other errors that fall under the
> TypeError error_type. I just want an error_type that is specific to this
> one particular error. So finding a list of available error_types would
> help me greatly.

While it is free to the programmer to use any Exception class she wants,
this is not the case for this problem.

There is no list other then whats documented in the python docs and in
the documentation of the given module or class.

As a programmer you can define as much exception classes and use them as 
you
like.

>
> Unless, of course, someone just gives me the answer - but that wouldn't be
> too helpful in the future.
>
> Give a man a fish, and it will feed him for a day...
> Teach a man to fish, and it will feed him for a lifetime.

I think a good idea would be to get a bit familar with python. It is not
so hard as it looks like at the beginning. You will then see why zope
works like it works now.
(http://www.python.org/ and see the tutorial at least)

Regards
Tino