| 123456789101112131415161718192021 |
- using System;
- using System.Runtime.ExceptionServices;
- namespace Abp.Extensions
- {
- /// <summary>
- /// Extension methods for <see cref="Exception"/> class.
- /// </summary>
- public static class ExceptionExtensions
- {
- /// <summary>
- /// Uses <see cref="ExceptionDispatchInfo.Capture"/> method to re-throws exception
- /// while preserving stack trace.
- /// </summary>
- /// <param name="exception">Exception to be re-thrown</param>
- public static void ReThrow(this Exception exception)
- {
- ExceptionDispatchInfo.Capture(exception).Throw();
- }
- }
- }
|