Skip to content

Commit

Permalink
Merge pull request #162 from MindscapeHQ/Remove-wrapper-exceptions
Browse files Browse the repository at this point in the history
Remove wrapper exceptions
  • Loading branch information
QuantumNightmare committed Jul 30, 2014
2 parents 3edf369 + 0735ced commit daf304d
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Mindscape.Raygun4Net.Tests/RaygunClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ public void StripMultipleWrapperExceptions()
Assert.AreEqual("System.NullReferenceException", message.Details.Error.ClassName);
}

[Test]
public void RemoveWrapperExceptions()
{
_client.RemoveWrapperExceptions(typeof(TargetInvocationException));

TargetInvocationException wrapper = new TargetInvocationException(_exception);

RaygunMessage message = _client.ExposeBuildMessage(wrapper);
Assert.AreEqual("System.Reflection.TargetInvocationException", message.Details.Error.ClassName);
}

// Validation tests

[Test]
Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net.WinRT/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exception (TargetInvocationException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

private static RaygunClient _client;

Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net.WindowsPhone/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exception (TargetInvocationException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

private static RaygunClient _client;

/// <summary>
Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net.WindowsStore/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exception (TargetInvocationException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

private static RaygunClient _client;

Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net.Xamarin.Android/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exceptions (TargetInvocationException and AggregateException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

/// <summary>
/// Transmits an exception to Raygun.io synchronously, using the version number of the originating assembly.
/// </summary>
Expand Down
15 changes: 14 additions & 1 deletion Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private bool ValidateApiKey()

/// <summary>
/// Adds a list of outer exceptions that will be stripped, leaving only the valuable inner exception.
/// This can be used when a wrapper exception, e.g. TargetInvocationException or HttpUnhandledException,
/// This can be used when a wrapper exception, e.g. TargetInvocationException or AggregateException,
/// contains the actual exception as the InnerException. The message and stack trace of the inner exception will then
/// be used by Raygun for grouping and display. The above two do not need to be added manually,
/// but if you have other wrapper exceptions that you want stripped you can pass them in here.
Expand All @@ -82,6 +82,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exceptions (TargetInvocationException and AggregateException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

/// <summary>
/// Transmits an exception to Raygun.io synchronously, using the version number of the originating assembly.
/// </summary>
Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exceptions (TargetInvocationException and HttpUnhandledException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

/// <summary>
/// Adds a list of keys to ignore when attaching the Form data of an HTTP POST request. This allows
/// you to remove sensitive data from the transmitted copy of the Form on the HttpRequest by specifying the keys you want removed.
Expand Down
11 changes: 11 additions & 0 deletions Mindscape.Raygun4Net2.Tests/RaygunClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ public void StripMultipleWrapperExceptions()
Assert.AreEqual("System.NullReferenceException", message.Details.Error.ClassName);
}

[Test]
public void RemoveWrapperExceptions()
{
_client.RemoveWrapperExceptions(typeof(TargetInvocationException));

TargetInvocationException wrapper = new TargetInvocationException(_exception);

RaygunMessage message = _client.ExposeBuildMessage(wrapper);
Assert.AreEqual("System.Reflection.TargetInvocationException", message.Details.Error.ClassName);
}

// Validation tests

[Test]
Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net2/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exceptions (TargetInvocationException and HttpUnhandledException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

/// <summary>
/// Adds a list of keys to ignore when attaching the Form data of an HTTP POST request. This allows
/// you to remove sensitive data from the transmitted copy of the Form on the HttpRequest by specifying the keys you want removed.
Expand Down
13 changes: 13 additions & 0 deletions Mindscape.Raygun4Net45/RaygunClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions)
}
}

/// <summary>
/// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception.
/// This can be used to remove the default wrapper exceptions (TargetInvocationException and HttpUnhandledException).
/// </summary>
/// <param name="wrapperExceptions">Exception types that should no longer be stripped away.</param>
public void RemoveWrapperExceptions(params Type[] wrapperExceptions)
{
foreach (Type wrapper in wrapperExceptions)
{
_wrapperExceptions.Remove(wrapper);
}
}

/// <summary>
/// Adds a list of keys to ignore when attaching the Form data of an HTTP POST request. This allows
/// you to remove sensitive data from the transmitted copy of the Form on the HttpRequest by specifying the keys you want removed.
Expand Down

0 comments on commit daf304d

Please sign in to comment.