mysql check exception handling