[Zope] catching exceptions thrown by gadfly db

Micheál Healy michael.healy@engitech.ie
Fri, 1 Nov 2002 14:10:40 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C281B0.754860A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

I am trying to catch and handle an exception thrown by the gadfly db.  =
My code is as follows:

<dtml-try>
  <dtml-call =
expr=3D"sql_add_software(p_custName=3DcustName,swName=3DswName)">
<dtml-except>
    An error occurred.
    Error type: <dtml-var error_type>
    Error value: <dtml-var error_value>
</dtml-try>

The error is thrown and caught (violation of a unique constraint), but =
it still inserts the row in the DB.

When I try to delete the identical rows, I get the following error:

Error, exceptions.ValueError: list.remove(x): x not in list

Any ideas?

TIA,

Miche=E1l Healy
------=_NextPart_000_0020_01C281B0.754860A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am trying to catch and handle an =
exception thrown=20
by the gadfly db.&nbsp; My code is as follows:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-try&gt;<BR>&nbsp; =
&lt;dtml-call=20
expr=3D"sql_add_software(p_custName=3DcustName,swName=3DswName)"&gt;<BR>&=
lt;dtml-except&gt;<BR>&nbsp;&nbsp;&nbsp;=20
An error occurred.<BR>&nbsp;&nbsp;&nbsp; Error type: &lt;dtml-var=20
error_type&gt;<BR>&nbsp;&nbsp;&nbsp; Error value: &lt;dtml-var=20
error_value&gt;<BR>&lt;/dtml-try&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The error is thrown and caught =
(violation of a=20
unique constraint), but it still inserts the&nbsp;row in the =
DB.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>When I try to delete the identical =
rows, I get the=20
following error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><STRONG>Error, <EM>exceptions.ValueError</EM>:</STRONG> =
list.remove(x): x=20
not in list</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Any ideas?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>TIA,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Miche=E1l =
Healy</FONT></DIV></BODY></HTML>

------=_NextPart_000_0020_01C281B0.754860A0--