Re: Error handling expectations

From: Andres Freund <andres(at)anarazel(dot)de>
To: James Coleman <jtc331(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error handling expectations
Date: 2018-10-15 17:28:26
Message-ID: 20181015172826.47q7xycihnhbycir@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Coleman 2018-10-15 17:30:47 Re: Error handling expectations
Previous Message James Coleman 2018-10-15 17:21:04 Error handling expectations