Custom Exception Handler in Mongo Spark Connectors

Hi Team,

I have a query related to handling exception in mongo-spark connector.

Problem Statement - We are running a Spark job in AWS which reads data from Mongo DB. For reading from mongo, we are using mongo-spark connector. However, if there are any issues such as few bad records, connection issues or some other temporary failures, we need to retry the entire.

Is there a way to integrate custom exception handler in mongo-spark connector where such scenarios can be handler ?