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@gmx.net http://yi.org/peter-e/