For my understanding you are getting an error that causes a rollback. I'm not sure you can catch that one.
So, one way is to increase the connection pool (that is the safe one). Another way maybe is to create a process, for this transaction purpose only. You will then can catch it in the main process.