Re: pgsql: Improve error messages for bytea decoding failures.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Improve error messages for bytea decoding failures.
Date: 2014-07-09 15:29:58
Message-ID: CA+Tgmoa3zLrW_A-bS9ftvdJYwVQHNRood+qk+BT5rbsn+2B+Xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, Jul 9, 2014 at 11:14 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <rhaas(at)postgresql(dot)org> writes:
>> Improve error messages for bytea decoding failures.
>
> Per style guide, errhints should be capitalized full sentences, ie
>
> - errhint("input data is missing padding, truncated, or otherwise corrupted")));
> + errhint("Input data is missing padding, truncated, or otherwise corrupted.")));

Oops.

> Also, it's unwise to use %c on a value you aren't sure is an ASCII
> character; that's likely to produce an invalidly-encoded error message,
> which will *not* be an improvement of the user experience.

Yeah, I was a little worried about that. But I noticed that in the
same file we already had this:

ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid hexadecimal digit: \"%c\"", c)));

So I figured it must be OK. If it's not, we should fix both places.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-07-09 15:35:11 pgsql: Fix error hint style.
Previous Message Tom Lane 2014-07-09 15:14:55 Re: pgsql: Improve error messages for bytea decoding failures.