mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
821 B
23 lines
821 B
using System;
|
|
using System.Runtime.ExceptionServices;
|
|
|
|
namespace ZeroLevel.Services.Async
|
|
{
|
|
/// <summary>
|
|
/// Provides helper (non-extension) methods dealing with exceptions.
|
|
/// </summary>
|
|
public static class ExceptionHelpers
|
|
{
|
|
/// <summary>
|
|
/// Attempts to prepare the exception for re-throwing by preserving the stack trace.
|
|
/// The returned exception should be immediately thrown.
|
|
/// </summary>
|
|
/// <param name="exception">The exception. May not be <c>null</c>.</param>
|
|
/// <returns>The <see cref="Exception"/> that was passed into this method.</returns>
|
|
public static Exception PrepareForRethrow(Exception exception)
|
|
{
|
|
ExceptionDispatchInfo.Capture(exception).Throw();
|
|
return exception;
|
|
}
|
|
}
|
|
} |