application readable error message - Mailing list pgsql-general

From SunWuKung
Subject application readable error message
Date
Msg-id c409c692-4ce0-4d69-9a95-5fc43514df3a@l33g2000pri.googlegroups.com
Whole thread Raw
Responses Re: application readable error message  (Raymond O'Donnell <rod@iol.ie>)
List 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


pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: Possible bug with ALTER LANGUAGE ... OWNER TO ...
Next
From: Joris Dobbelsteen
Date:
Subject: Re: Query Question (one group by vs two separate)