[Zope-dev] urgent: string exceptions

Christian Theune ct@gocept.com
11 Apr 2003 10:26:50 +0200


Hi.

I'm stuck with trying to catch a string exception from the zope core
within a python script of cmf.

When using invokeFactory one can expect it to raise a "Bad Request"
(string) exception e.g. when you want to create an object with a
duplicate id.

Within a python script I tried:

try:
    ... invokeFactory ...
except "Bad Request", v:
    ...

but that doesn't catch the exception. Using an anonymous except: clause
is not an acceptable way because a) they are evil b) i can't get to the
exception value anymore.

I need to solve a problem related to that soon. I now have some things I
can imagine to do:

a) Remove "Bad Request" beeing a String exception and make it a class
exception

b) Get a hint on how to actually catch the string exception within a
python script and get to the exception value

c) (Not good but if it works) Catch it anonymously *and* get to the
exception value.

Thanks for listening,
Christian

-- 
Christian Theune, gocept gmbh & co. kg
http://www.gocept.com - ct@gocept.com
fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366