correcting db error handling

--HG--
extra : source : eed99aabd2a8f38c37cd84203b42c8fcd221fd85