Re: errmsg("... because ...") - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: errmsg("... because ...")
Date
Msg-id 200412112037.53401.peter_e@gmx.net
Whole thread Raw
In response to errmsg("... because ...")  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List 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/


pgsql-hackers by date:

Previous
From: "Andrew Dunstan"
Date:
Subject: Re: regression script/makefile exit failure
Next
From: Pucky Loucks
Date:
Subject: port report: OSX 10.3