Qua c'è anche qualcosa che parla degli errori(manuale mysql)

http://dev.mysql.com/doc/mysql/en/Error-handling.html