Re: More on elog and error codes

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: More on elog and error codes
Дата
Msg-id Pine.LNX.4.30.0103201726200.1639-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: More on elog and error codes  (Philip Warner <pjw@rhyme.com.au>)
Ответы Re: More on elog and error codes  (Philip Warner <pjw@rhyme.com.au>)
Список 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@gmx.net       http://yi.org/peter-e/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: src/test/regress/README duplicates SGML material
Следующее
От: Zeugswetter Andreas SB
Дата:
Сообщение: AW: Re: More on elog and error codes