Re: Error handling strategies (db related)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 27, 2010 at 10:42:03AM +0200, Gary . wrote:

> How do you guys handle errors during, say, db insertions.
> 
> Let's say you have an ongoing transaction which fails on the n-th
> insert. Ok, you roll back the transaction, no problem. How do you then
> inform the user? Just using the text from pg_result_error  or
> something?

I use trigger_error() and stop execution at that point. I give the user
an error that basically says, "Talk to the admin/programmer". And I send
the programmer a message containing a trace of what occurred. The theory
is that, all things being equal, such an error should never occur and
there is no user recovery. If the user properly entered the data they
were asked for, then the transaction should go through without incident.
If something prevents the transaction from going through, it's likely a
coding problem and up to the programmer or admin to repair.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux