Re: Error handling expectations - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Error handling expectations
Date
Msg-id 20181015172826.47q7xycihnhbycir@alap3.anarazel.de
Whole thread Raw
In response to Error handling expectations  (James Coleman <jtc331@gmail.com>)
Responses Re: Error handling expectations  (James Coleman <jtc331@gmail.com>)
List pgsql-hackers
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 by date:

Previous
From: James Coleman
Date:
Subject: Error handling expectations
Next
From: James Coleman
Date:
Subject: Re: Error handling expectations