IndexOutOfRangeException: GetBaseException |
Gets the original exception that caused the chain of exceptions to occur.
Public Function GetBaseException ( ) As Exception
If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.
When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.