Re: Error message style guide - Mailing list pgsql-hackers

From Jeff
Subject Re: Error message style guide
Date
Msg-id Pine.BSF.4.44.0303171002370.87147-100000@torgo.978.org
Whole thread Raw
In response to Re: Error message style guide  (Steve Crawford <scrawford@pinpointresearch.com>)
List pgsql-hackers
On Fri, 14 Mar 2003, Steve Crawford wrote:

> One thing that would be great from a user's perspective (and which might
> reduce the volume of support questions as well) is to uniquely number all
> errors as in:
> Error 1036: the foo could not faz the fleep
>

I agree with the unique codes.
It does make googling for help easier.

This is how informix does it - you get a sqlstate and what they call a
'native error'.  Using SQLError (odbc) you can get a one liner about it,
but the real meat comes from either the documentation or from the command
line program "finderr".  You give it the native error and it gives you a
paragraph of information about the problem and what options you have.

Plus, if you have a numeric code sent back you can have an error handler
that looks quite a bit nicer -

switch(pgErrorCode)
{case PG_HDD_ON_FIRE:    die_horrifically();    break;case PG_UNKNOWN_USER:    tell_user_he_is_dumb();    break;
}

instead of a big pile of strcmp's.

From an efficiency standpoint, I don't know if it would have any benefit
of sending back a native code and have the client ask for the details if
it wants it.

------------------------------------------------------------------------------
Jeff Trout <jeff@jefftrout.com>                  http://www.jefftrout.com/  Ronald McDonald, with the help of cheese
soup,     controls America from a secret volkswagon hidden in the past
 
-------------------------------------------------------------------------------




pgsql-hackers by date:

Previous
From: "Peter Galbavy"
Date:
Subject: Re: ALTER USER
Next
From: Tom Lane
Date:
Subject: Error-message infrastructure: what about location in PL functions?