How to know what kind exception is happened to our rpa

Thats why i want to make a log file individually with my automation so i can capture what kind of exception that happen to my automation. But i dont know how to capture that exception, someone help pls!