Re: pgsql: Improve error messages for bytea decoding failures. - Mailing list pgsql-committers

From Robert Haas
Subject Re: pgsql: Improve error messages for bytea decoding failures.
Date
Msg-id CA+Tgmoa3zLrW_A-bS9ftvdJYwVQHNRood+qk+BT5rbsn+2B+Xg@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Improve error messages for bytea decoding failures.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On Wed, Jul 9, 2014 at 11:14 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <rhaas@postgresql.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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Improve error messages for bytea decoding failures.
Next
From: Robert Haas
Date:
Subject: pgsql: Fix error hint style.