Trapping Exceptions

Dale Strickland-Clark dale at out-think.NOSPAMco.uk
Wed Nov 8 07:55:29 EST 2000


I'm having a bit of trouble trapping an exception raised by one of my
own classes.

The code trying to trap the exception is:

try:
	if type(fld) == types.InstanceType:
		parts.append(RenderObj.Data(fld.Heading,
fld.Description))
	else:
		parts.append(RenderObj.Data(self.FieldHdr(f), fld))
except Hell:
	pass


The requests for the attributes of fld may raise this exception:

if self.RS is None:
	raise Hell(21, (key, self.__class__.__name__))
return self.FormatField(key, self.RS.Fields(key).value)


However, the exception isn't getting trapped. Now, I suspect it's
something to do with the Hell object but I can't figure out what. My
understanding of the docs and experiments with simpler cases suggests
that this should work

Any help appreciated.


--
Dale Strickland-Clark
Out-Think Ltd
Business Technology Consultants





More information about the Python-list mailing list