pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedTrapping PostgreSQL error messages
2+ messages / 2 participants
[nested] [flat]
* Trapping PostgreSQL error messages
@ 2006-01-11 21:02 Lynna Landstreet <lynna@spidersilk.net>
0 siblings, 1 reply; 2+ messages in thread
From: Lynna Landstreet @ 2006-01-11 21:02 UTC (permalink / raw)
To: pgsql-php
Hi there,
This may be a really basic question to those who have more programming
experience than I do, but I was wondering if there's any good way to trap
PostgreSQL error messages so that they're logged to a file, but a site user
doesn't see them and gets a more user-friendly error message instead.
I have a few standard things in there like "or die" with a custom error
message in brackets after pg_query statements, but what that seems to
generate is the regular messy PostgreSQL error messages *plus* whatever I
put in for the die message, rather than my message being displayed *instead*
of the ones the server generates. Is there a way of changing this so that I
can provide a friendlier error message and keep the more detailed ones
logged somewhere for my own viewing?
Searching the web, I did find this:
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.htm
l#PLPGSQL-ERROR-TRAPPING
But found it a bit confusing, probably because I'm not all that certain what
PL/pgSQL is, or if/how you could apply this in practice on a PHP-based site.
Could the exception statements they're using there be used to generate
custom error messages? Would the original PostgreSQL error message with all
detail still be recorded somewhere?
Is there a more detailed (and/or comprehensible to a not-so-experienced
programmer) explanation of this somewhere?
Lynna
--
Spider Silk Design - http://www.spidersilk.net
509 St Clair W Box 73576, Toronto ON Canada M6C 1C0
Tel 416.651.2899 - Toll Free 1.866.651.2899 - Cell 416.873.9289
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Trapping PostgreSQL error messages
@ 2006-01-11 21:23 Sean Hamilton <sehamilt@chfund.org>
parent: Lynna Landstreet <lynna@spidersilk.net>
0 siblings, 0 replies; 2+ messages in thread
From: Sean Hamilton @ 2006-01-11 21:23 UTC (permalink / raw)
To: Lynna Landstreet <lynna@spidersilk.net>; pgsql-php
Check out your php.ini file. See the section on error handling.
change:
display_erros = Off
log_errors = On
-Sean
Lynna Landstreet wrote:
>Hi there,
>
>This may be a really basic question to those who have more programming
>experience than I do, but I was wondering if there's any good way to trap
>PostgreSQL error messages so that they're logged to a file, but a site user
>doesn't see them and gets a more user-friendly error message instead.
>
>I have a few standard things in there like "or die" with a custom error
>message in brackets after pg_query statements, but what that seems to
>generate is the regular messy PostgreSQL error messages *plus* whatever I
>put in for the die message, rather than my message being displayed *instead*
>of the ones the server generates. Is there a way of changing this so that I
>can provide a friendlier error message and keep the more detailed ones
>logged somewhere for my own viewing?
>
>Searching the web, I did find this:
>http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.htm
>l#PLPGSQL-ERROR-TRAPPING
>But found it a bit confusing, probably because I'm not all that certain what
>PL/pgSQL is, or if/how you could apply this in practice on a PHP-based site.
>Could the exception statements they're using there be used to generate
>custom error messages? Would the original PostgreSQL error message with all
>detail still be recorded somewhere?
>
>Is there a more detailed (and/or comprehensible to a not-so-experienced
>programmer) explanation of this somewhere?
>
>
>Lynna
>
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-01-11 21:23 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-11 21:02 Trapping PostgreSQL error messages Lynna Landstreet <lynna@spidersilk.net>
2006-01-11 21:23 ` Sean Hamilton <sehamilt@chfund.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox