/src/LinFu.AOP/ExceptionHandlerInfo.cs

http://github.com/philiplaureano/LinFu · C# · 50 lines · 17 code · 6 blank · 27 comment · 0 complexity · 0837739979c8f6c9901d38186113d185 MD5 · raw file

  1. using System;
  2. using LinFu.AOP.Interfaces;
  3. namespace LinFu.AOP.Cecil
  4. {
  5. /// <summary>
  6. /// Represents a class that describes the context of a thrown exception.
  7. /// </summary>
  8. public class ExceptionHandlerInfo : IExceptionHandlerInfo
  9. {
  10. /// <summary>
  11. /// Initializes a new instance of the <see cref="ExceptionHandlerInfo" /> class.
  12. /// </summary>
  13. /// <param name="ex">The thrown exception.</param>
  14. /// <param name="invocationInfo">The <see cref="IInvocationInfo" /> instance that describes the context of the method call.</param>
  15. public ExceptionHandlerInfo(Exception ex, IInvocationInfo invocationInfo)
  16. {
  17. Exception = ex;
  18. InvocationInfo = invocationInfo;
  19. }
  20. /// <summary>
  21. /// Gets the value indicating the thrown exception.
  22. /// </summary>
  23. /// <value>The thrown exception.</value>
  24. public Exception Exception { get; }
  25. /// <summary>
  26. /// Gets the value indicating the <see cref="IInvocationInfo" /> instance that describes the context of the method
  27. /// that threw the exception.
  28. /// </summary>
  29. /// <value>The <see cref="IInvocationInfo" /> instance.</value>
  30. public IInvocationInfo InvocationInfo { get; }
  31. /// <summary>
  32. /// Gets or sets the value indicating the return value that will be used in place of the original return value if
  33. /// the exception is intercepted by an <see cref="IExceptionHandler" /> instance.
  34. /// </summary>
  35. /// <value>The method return value.</value>
  36. public object ReturnValue { get; set; }
  37. /// <summary>
  38. /// Gets or sets the value indicating whether or not the exception should be rethrown after
  39. /// the <see cref="IExceptionHandler" /> handles the given exception.
  40. /// </summary>
  41. /// <value>This should be <c>true</c> if the exception should be rethrown, otherwise, it must be <c>false</c>.</value>
  42. public bool ShouldSkipRethrow { get; set; }
  43. }
  44. }