Retrieve the error message occurred due to action performed

I have a requirement to retrieve the error message occurred and send an email to the developers. I can achieve this using the traceback module. where as I didn't find a way to retrieve the exact message that displays in the error message dialog box of perspective.

I am keeping this message that's being displayed above as the subject of the email body and the details as the body of the email. I am wanting to retrieve the component path from where the error occurred and why( was it due to action performer /value changed and it's path ) .
Could anyone suggest if there is any way to retrieve this message in perspective.


Sounds like you just want to capture the errors in your code. I normally output these to the loggers using system.util.getLogger(....)
But you could do the same with sending emails.

In your code you could have some kind of Try except and get the error message and send the email off.

Something like:

from java.lang import Throwable

except Exception as e:
     #Pythonic error
     error = e
except Throwable as e:
     #Java based error
     error = e

Thanks @Hayden_Watson , I am able to get the error that occurred in my code. Where as what I am trying to retrieve is the on what action the error occurred and component name , as in the above screenshot the message states " component action performed' on the ticketUI/ test Errror@D/root/button'.