[PATCH] fix for bug 12292

Alexander Bokovoy ab at samba.org
Wed Sep 28 14:37:37 UTC 2016


On ke, 28 syys 2016, Rowland Penny wrote:
> > > > However, I think Douglas was trying to point out that it is bad
> > > > practice in Python programming to have 'except' without specific
> > > > exception -- catch-all cases are almost every time wrong. So if
> > > > you know that there will be an index error, just catch that
> > > > exception type to handle it properly.
> > > 
> > > Well yes, but I only found out what the exception was by adding
> > > 'Exception, e' to the line i.e. I hadn't a clue
> > > 
> > > I personally think you are all getting bogged down in technicalities
> > > here, what does it matter why the user couldn't be found, it
> > > couldn't be found!
> > Correct. However, if there would be another reason, like genuine error
> > in the underlying software stack, the 'except IndexError, e' exception
> > handling would allow us to crash with a proper backtrace to see that
> > issue. A plain 'except:' or 'except Exception, e' will cover up any
> > error and will complicate debugging. That's one point why we insist on
> > this technicality.
> > 
> 
> OK, that's me over there waving the white flag ;-)
> 
> I will alter the patch to use 'except IndexError, e' ,
> but before I do, is there anything else wrong with my patch ???
I don't see anything else being incorrect in it.

-- 
/ Alexander Bokovoy



More information about the samba-technical mailing list