[PHP] Error handling strategies (db related)

2010-04-27 Thread Gary .
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? -- PHP General Mailing List

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Peter Lind
On 27 April 2010 10:42, 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_err

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Michiel Sikma
On 27 April 2010 10:42, 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_er

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Paul M Foster
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

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Peter Lind
On 27 April 2010 15:36, Paul M Foster wrote: > 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. Ho

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Gary .
On Tue, Apr 27, 2010 at 10:46 AM, Peter Lind wrote: > On 27 April 2010 10:42, 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

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Paul M Foster
On Tue, Apr 27, 2010 at 03:41:04PM +0200, Peter Lind wrote: > On 27 April 2010 15:36, Paul M Foster wrote: > > 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

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Peter Lind
On 27 April 2010 16:07, Paul M Foster wrote: > On Tue, Apr 27, 2010 at 03:41:04PM +0200, Peter Lind wrote: > >> On 27 April 2010 15:36, Paul M Foster wrote: >> > On Tue, Apr 27, 2010 at 10:42:03AM +0200, Gary . wrote: >> > >> >> How do you guys handle errors during, say, db insertions. >> >> >> >

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Paul M Foster
On Tue, Apr 27, 2010 at 04:13:20PM +0200, Peter Lind wrote: > On 27 April 2010 16:07, Paul M Foster wrote: > > On Tue, Apr 27, 2010 at 03:41:04PM +0200, Peter Lind wrote: > > > >> On 27 April 2010 15:36, Paul M Foster wrote: > >> > On Tue, Apr 27, 2010 at 10:42:03AM +0200, Gary . wrote: > >> > >

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Peter Lind
On 27 April 2010 16:24, Paul M Foster wrote: > On Tue, Apr 27, 2010 at 04:13:20PM +0200, Peter Lind wrote: > >> On 27 April 2010 16:07, Paul M Foster wrote: >> > On Tue, Apr 27, 2010 at 03:41:04PM +0200, Peter Lind wrote: >> > >> >> On 27 April 2010 15:36, Paul M Foster wrote: >> >> > On Tue, Ap

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Nathan Rixham
Peter Lind wrote: > On 27 April 2010 16:24, Paul M Foster wrote: >> On Tue, Apr 27, 2010 at 04:13:20PM +0200, Peter Lind wrote: >> >>> On 27 April 2010 16:07, Paul M Foster wrote: On Tue, Apr 27, 2010 at 03:41:04PM +0200, Peter Lind wrote: > On 27 April 2010 15:36, Paul M Foster wr

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Teus Benschop
> I'm still shocked you guys are still writing code that has errors in it, > what's worse is you know about the errors, and instead of fixing them > you're just telling the user about it! > The point here is that we, programmers, know that we write code with bugs in it. We are realistic about it,

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread tedd
At 9:36 AM -0400 4/27/10, Paul M Foster wrote: 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 yo

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Nathan Rixham
Teus Benschop wrote: >> I'm still shocked you guys are still writing code that has errors in it, >> what's worse is you know about the errors, and instead of fixing them >> you're just telling the user about it! >> > > The point here is that we, programmers, know that we write code with > bugs in

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread tedd
At 4:13 PM +0200 4/27/10, Peter Lind wrote: If only the world consisted of smart users ... I think, however, that we're generally closer to the opposite. And no, I don't hate users - I've just seen too many people do things that were very far removed from "smart". Regards Peter Peter et al: S

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread tedd
At 10:24 AM -0400 4/27/10, Paul M Foster wrote: Unfortunately, true. Sometimes I think computer users should be required to take a course in using a computer before being allowed behind the keyboard. Paul Yeah, like I believe that everyone should do through at least one divorce before getting

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Ashley Sheridan
On Tue, 2010-04-27 at 12:12 -0400, tedd wrote: > At 4:13 PM +0200 4/27/10, Peter Lind wrote: > >If only the world consisted of smart users ... I think, however, that > >we're generally closer to the opposite. And no, I don't hate users - > >I've just seen too many people do things that were very f

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread tedd
At 4:31 PM +0200 4/27/10, Peter Lind wrote: While I love to rant at stupid users, the truth is probably that programmers are the ones who should take courses in how users think. In the end, if I fail to understand my users, it doesn't matter how great my program is: they'll still fail to use it.

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread tedd
At 4:23 PM +0100 4/27/10, Nathan Rixham wrote: I'm still shocked you guys are still writing code that has errors in it, what's worse is you know about the errors, and instead of fixing them you're just telling the user about it! :p Here's my code that doesn't contain errors: Cheers, ted

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Peter Lind
On 27 April 2010 18:21, tedd wrote: > At 4:31 PM +0200 4/27/10, Peter Lind wrote: >> >> While I love to rant at stupid users, the truth is probably that >> programmers are the ones who should take courses in how users think. >> In the end, if I fail to understand my users, it doesn't matter how >>

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread tedd
At 5:09 PM +0100 4/27/10, Ashley Sheridan wrote: Sounds like you've got a few stories that would a lot of people happy were you to share them on the DailyWTF ;) Thanks, Ash Ash: Sharing them here is more direct and meaningful to what we do, but I will investigate what you suggest. Che

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Ashley Sheridan
On Tue, 2010-04-27 at 12:31 -0400, tedd wrote: > At 5:09 PM +0100 4/27/10, Ashley Sheridan wrote: > >> > > > >Sounds like you've got a few stories that would a lot of people > >happy were you to share them on the DailyWTF ;) > > > >Thanks, > >Ash > > Ash: > > Sharing them here is more direct an

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Paul M Foster
On Tue, Apr 27, 2010 at 12:12:31PM -0400, tedd wrote: > At 4:13 PM +0200 4/27/10, Peter Lind wrote: >> If only the world consisted of smart users ... I think, however, that >> we're generally closer to the opposite. And no, I don't hate users - >> I've just seen too many people do things that were

RE: [PHP] Error handling strategies (db related)

2010-04-27 Thread Tommy Pham
At 10:24 AM -0400 4/27/10, Paul M Foster wrote: >Unfortunately, true. Sometimes I think computer users should be >required to take a course in using a computer before being allowed >behind the keyboard. > >Paul I came across a term long ago amidst my readings: PEBKAC Problem Exists Between Keybo

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Gary .
On 4/27/10, tedd wrote: > At 4:23 PM +0100 4/27/10, Nathan Rixham wrote: >> >>I'm still shocked you guys are still writing code that has errors in it, >>what's worse is you know about the errors, and instead of fixing them >>you're just telling the user about it! >> >>:p > > Here's my code that doe

Re: [PHP] Error handling strategies (db related)

2010-04-27 Thread Andrew Ballard
On Tue, Apr 27, 2010 at 12:23 PM, tedd wrote: > At 4:23 PM +0100 4/27/10, Nathan Rixham wrote: >> >> I'm still shocked you guys are still writing code that has errors in it, >> what's worse is you know about the errors, and instead of fixing them >> you're just telling the user about it! >> >> :p

Re: [PHP] Error handling strategies (db related)

2010-04-28 Thread Pete Ford
On 27/04/10 16:37, tedd wrote: Error handling is almost an art form. More like a black art - voodoo perhaps... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Error handling strategies (db related)

2010-04-28 Thread viraj
On Tue, Apr 27, 2010 at 7:34 PM, Gary . wrote: > On Tue, Apr 27, 2010 at 10:46 AM, Peter Lind wrote: >> On 27 April 2010 10:42, 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