Microsoft.CodeAnalysis.Sarif.ExceptionData.GetInnerExceptions C# (CSharp) Method

GetInnerExceptions() private static method

private static GetInnerExceptions ( Exception exception ) : IList
exception System.Exception
return IList
        private static IList<ExceptionData> GetInnerExceptions(Exception exception)
        {
            var innerExceptions = new List<ExceptionData>();

            IReadOnlyCollection<Exception> aggregateInnerExceptions = (exception as AggregateException)?.InnerExceptions;
            if (aggregateInnerExceptions != null)
            {
                foreach (Exception innerException in aggregateInnerExceptions)
                {
                    innerExceptions.Add(Create(innerException));
                }
            }
            else if (exception.InnerException != null)
            {
                innerExceptions.Add(Create(exception.InnerException));
            }

            return innerExceptions;
        }