What about creating a SAVEPOINT before each INSERT, and if the INSERT returns an error, then ROLLBACK TO SAVEPOINT?
Make sure you release the savepoint if there was no error. Otherwise you will quickly run out of memory.
Also, if there was an error, then after rolling back to the savepoint either release it, or refrain from starting a new one at the beginning of the next insert.