extractNonInvocationTargetException

Extracts the first non-InvocationTargetException from the given Throwable. This function will be used during exception handling to extract the actual exception that occurred.