Which DB driver are you using? Are you looking for DB errors? Some of them just happily sail past any DB errors and you have to call a function specifically to check for DB errors. your DB should throw an error on duplicate data, and you can pick that error up and alert the user.