From: | Jeff <threshar(at)torgo(dot)978(dot)org> |
---|---|
To: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Error message style guide |
Date: | 2003-03-17 15:10:50 |
Message-ID: | Pine.BSF.4.44.0303171002370.87147-100000@torgo.978.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)jefftrout(dot)com> http://www.jefftrout.com/
Ronald McDonald, with the help of cheese soup,
controls America from a secret volkswagon hidden in the past
-------------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-03-17 16:40:15 | Error-message infrastructure: what about location in PL functions? |
Previous Message | Peter Galbavy | 2003-03-17 14:32:47 | Re: ALTER USER |