error handling...

From: Bob Bie (bob1234_at_pi.be)
Date: 03/21/04


Date: 21 Mar 2004 06:58:33 -0800

Hello,

I'm currently developing an application in Java and I'm using a
postgres database. I created a unique constrained on one of my tables.
So if I try to insert a second time the same I get an error, and
that's very good. I catch the error in my java-application (try{}
catch(SQLEception err) {...}).

When the unique contraint is triggerd I get ERROR: Cannot insert a
duplicate key into unique index...

I can do a stringcompare on this text to see if the exception is this
error or not but I was wondering if there is a more gracefull
sollution. Maybe there exists errorcodes or sommething like that?

Has anyone an answer for this?

thanx in advance,
Bob