On 27 April 2010 10:42, Gary . <php-gene...@garydjones.name> 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? >
If it's a normal user, give them some info about what went wrong but not the specific error returned. If it's an admin with dev knowledge (i.e. you) then consider handing out the returned error as well. Rule of thumb: aim to inform the user without confusing. There's nothing worse than "This didn't work, sorry" - why didn't it work?? Was it my fault? Can I get it to work somehow? Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 </hype> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php