X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D813A9DC803 for ; Wed, 11 Jan 2006 17:23:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91771-09 for ; Wed, 11 Jan 2006 17:23:32 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 408359DC839 for ; Wed, 11 Jan 2006 17:23:29 -0400 (AST) Received: from cyrano.chfund.org (mail.chfund.org [209.208.140.195]) by svr4.postgresql.org (Postfix) with ESMTP id 9E3165AF083 for ; Wed, 11 Jan 2006 21:23:31 +0000 (GMT) Received: from GWIASVR1.chfund.org (www.chfund.org [10.125.10.11]) by cyrano.chfund.org (Postfix) with ESMTP id A48CE13C003 for ; Wed, 11 Jan 2006 16:23:43 -0500 (EST) Received: from [127.0.0.1] (arisia.chfund.org [10.125.10.3]) by GWIASVR1.chfund.org; Wed, 11 Jan 2006 16:23:42 -0500 Message-ID: <43C5775D.9080608@chfund.org> Date: Wed, 11 Jan 2006 16:23:41 -0500 From: Sean Hamilton User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Lynna Landstreet , pgsql-php@postgresql.org Subject: Re: Trapping PostgreSQL error messages References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200601/31 X-Sequence-Number: 3402 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 > > >