Eg when the error is
Error query: SQLSTATE: Integrity constraint violation: 1062 Duplicate entry, it would detect 2300 instead of 1062.
Now PDO and MySQLi uses same code in tracker and regular mode. Ideally would refactor it to use the same method in the background. Not sure if I find time.
Now reusing same code and added a basic test