Files
Wino-Mail/Wino.Core.Domain/Extensions/ExceptionExtensions.cs
2025-02-16 11:54:23 +01:00

24 lines
528 B
C#

using System;
using System.Collections.Generic;
namespace Wino.Core.Domain.Extensions;
public static class ExceptionExtensions
{
public static IEnumerable<Exception> GetInnerExceptions(this Exception ex)
{
if (ex == null)
{
throw new ArgumentNullException("ex");
}
var innerException = ex;
do
{
yield return innerException;
innerException = innerException.InnerException;
}
while (innerException != null);
}
}