application readable error message

From: SunWuKung <Balazs(dot)Klein(at)t-online(dot)hu>
To: pgsql-general(at)postgresql(dot)org
Subject: application readable error message
Date: 2008-12-13 19:13:39
Message-ID: c409c692-4ce0-4d69-9a95-5fc43514df3a@l33g2000pri.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I am trying to return an application error message on certain db
raised errors to the form the info came from.
What is the usual way for an application to identify the source of an
error?
The info (error type, table, column) is sometimes in the error message
sometimes not, but even when it is there trying to pars the human
readable message is surely not the best approach.

How do you people do it?
Thanks for the help.
SWK

Eg.
- null value in column "langid" violates not-null constraint - non-
null constraint violation, column, table
- ERROR: insert or update on table "instrumentheader" violates
foreign key constraint "instrumentheader_fk"
DETAIL: Key (langid)=(ddd) is not present in table "lang". -
foreign key violation, column, table
ERROR: ExecInsert: rejected due to CHECK constraint "username_valid"
on "users" - check constraint violation, column, table
- ERROR: invalid input syntax for integer: "sss" - datatype mismatch,
column, table

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joris Dobbelsteen 2008-12-14 00:51:05 Re: Query Question (one group by vs two separate)
Previous Message Erik Jones 2008-12-13 01:11:22 Re: Possible bug with ALTER LANGUAGE ... OWNER TO ...