Re: More on elog and error codes

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: More on elog and error codes
Date: 2001-03-20 16:35:42
Message-ID: Pine.LNX.4.30.0103201726200.1639-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner writes:

> elog(CACHELOOKUPFAIL, cacheItemThatFailed);

The disadvantage of this approach, which I tried to explain in a previous
message, is that we might want to have different wordings for different
occurences of the same class of error.

Additionally, the whole idea behind having error *codes* is that the
client program can easily distinguish errors that it can handle specially.
Thus the codes should be numeric or some other short, fixed scheme. In
the backend they could be replaced by macros.

Example:

#define PGERR_TYPE 1854

/* somewhere... */

elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already exists", ...)

/* elsewhere... */

elogc(ERROR, PGERR_TYPE, "type %s used as argument %d of function %s doesn't exist", ...)

In fact, this is my proposal. The "1854" can be argued, but I like the
rest.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-03-20 16:38:15 Re: Re: src/test/regress/README duplicates SGML material
Previous Message Tom Lane 2001-03-20 16:30:20 Re: Re: src/test/regress/README duplicates SGML material