Re: errmsg("... because ...")

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: errmsg("... because ...")
Date: 2004-12-11 19:37:53
Message-ID: 200412112037.53401.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:
> errmsg("cannot assign to field \"%s\" of column \"%s\" because its
> type %s is not a composite type")
>
> What do you think of changing those to use errdetail in addition to
> errmsg? So this particular example would become something like
>
> errmsg("cannot assign to field \"%s\" of column \"%s\"),
> errdetail("Its type %s is not a composite type.")

The style guidelines state that an error message should include the
reason for the error. That is fully intentional, and I would consider
the above to be a step backward.

In fact, every use of %m would fall into your bunch as well. We only
write "could not open file: %m" instead of "could not open file because
%m" for grammatical reasons. I don't think splitting out the %m would
be an improvement.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pucky Loucks 2004-12-11 19:58:56 port report: OSX 10.3
Previous Message Andrew Dunstan 2004-12-11 19:26:15 Re: regression script/makefile exit failure