How to determine which Appium driver throws exception in case of multi driver tests

I am writing tests which creates multiple Appium drivers and single testNG test runs on multiple devices for messaging scenarios.

Now if test throws an exception, I need to know which driver throws exception so that i can capture the right screenshot.

Is there a way to find this?

use if else statement for each driver class and add the screenshot method in else statement so that screenshot captured when the driver fails