Re: Error handling expectations

Поиск
Список
Период
Сортировка
От James Coleman
Тема Re: Error handling expectations
Дата
Msg-id CAAaqYe-uLOXiFVwafrB0m4ijhh_jm7ksYNi=KFA=aTTjeeWfsA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Error handling expectations  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Perfect. Thanks for the pointer, Andres, that's exactly what I was looking for.

On Mon, Oct 15, 2018 at 1:28 PM Andres Freund <andres@anarazel.de> wrote:
Hi,

On 2018-10-15 13:21:04 -0400, James Coleman wrote:
> This my first real foray into the Postgres codebase, so an beginner
> question: I noticed that existing C functions in pageinspect often do error
> checking and then report the error with ereport but still continue on to
> execute the rest of the function instead of early returning. Is this
> standard practice? Or should I be reporting the error and then cleaning up
> and returning rather than continuing to execute?

ereport basically throws an exception when elevel >= ERROR. I suggest
looking at elog.h's comments above elog and PG_TRY().

Greetings,

Andres Freund

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Error handling expectations
Следующее
От: Corey Huinker
Дата:
Сообщение: Re: CopyFrom() has become way too complicated