Prevent errors raising exceptions
Sometimes a QueryException is raised where getCode returns a non int value. This throws an undecipherable error and buries the correct SQL error reporting.
In my case, MySQL was returning HY000 in the getCode result.