correct old-style use of Error tuple, and remove check of a mysql errno, instead using more general IntegrityError