summaryrefslogtreecommitdiff
path: root/lib/infrastructure/proxies/ExceptionExtensions.cs
blob: 7b7b4d562817fd4b783e39187958f647baceb228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
using System.Reflection;

namespace jive.infrastructure.proxies
{
  static public class ExceptionExtensions
  {
    static readonly MethodInfo method =
      typeof (Exception).GetMethod("InternalPreserveStackTrace",
          BindingFlags.NonPublic | BindingFlags.Instance);

    static public Exception preserve_stack_trace(this Exception exception)
    {
      method.Invoke(exception, new object[0]);
      return exception;
    }
  }
}