Exception handling in mysql module