String toString()
The toString() method formats the exception information for the current exception as follows:
exceptionType: messageText
In the line above, exceptionType is the exception object's exception type and messageText is its exception text.
The following example writes the current exception information to the String variable newmessage:
String newmessage = currentException.toString();