using System; using System.Runtime.ExceptionServices; namespace ZeroLevel.Services.Async { /// /// Provides helper (non-extension) methods dealing with exceptions. /// public static class ExceptionHelpers { /// /// Attempts to prepare the exception for re-throwing by preserving the stack trace. /// The returned exception should be immediately thrown. /// /// The exception. May not be null. /// The that was passed into this method. public static Exception PrepareForRethrow(Exception exception) { ExceptionDispatchInfo.Capture(exception).Throw(); return exception; } } }