From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: libpq error message refactoring
Date: Tue, 15 Nov 2022 11:32:20 +0000
Message-ID: <E1ouuAt-000IiZ-AJ@gemulon.postgresql.org> (raw)
libpq error message refactoring
libpq now contains a mix of error message strings that end with
newlines and don't end with newlines, due to some newer code paths
with new ways of passing errors around. This leads to confusion and
mistakes both during development and translation.
This adds new functions libpq_append_error() and
libpq_append_conn_error() that encapsulate common code paths for
producing error message strings. Notably, these functions append the
newline, so that the string appearing in the code does not end with a
newline. This makes (almost) all error message strings in libpq
uniform in this regard (and also consistent with how we handle it
outside of libpq code). (There are a few exceptions that are
difficult to fit into this scheme, but they are only a few.)
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://www.postgresql.org/message-id/flat/7c0232ef-7b44-68db-599d-b327d0640a77@enterprisedb.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0873b2d354b9c73a69067c0afb92e35994adc47e
Modified Files
--------------
src/interfaces/libpq/fe-misc.c | 59 ++++++++++++++++++++++++++++++++++++++
src/interfaces/libpq/libpq-int.h | 3 ++
src/interfaces/libpq/nls.mk | 8 ++++--
src/interfaces/libpq/pqexpbuffer.c | 4 +--
src/interfaces/libpq/pqexpbuffer.h | 10 +++++++
5 files changed, 79 insertions(+), 5 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: libpq error message refactoring
In-Reply-To: <E1ouuAt-000IiZ-AJ@gemulon.postgresql.org>
References: <E1ouuAt-000IiZ-AJ@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox