
Catching errors in Python
I'm trying to catch any possible errors arising from a SQL UPDATE (such as a duplicate key value) so that I can display a custom error message. I've tried the following code
Code:
try:
runUpdateQuery(blah)
except:
print "Error"
without success - even when the update fails the standard warning appears and 'Error' never gets printed in the console.
Is what I'm trying to do possible?