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