Skip to content

Commit

Permalink
Merge pull request #407 from MindscapeHQ/Automatic-UnhandledException…
Browse files Browse the repository at this point in the history
…-tag

Automatic unhandled exception tag
  • Loading branch information
QuantumNightmare authored Jul 17, 2019
2 parents e03e270 + 585eeed commit d59749c
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 23 deletions.
4 changes: 2 additions & 2 deletions AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.7.0.0")]
[assembly: AssemblyFileVersion("5.7.0.0")]
[assembly: AssemblyVersion("5.8.0.0")]
[assembly: AssemblyFileVersion("5.8.0.0")]
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Core.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Core.Signed</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Core</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Mvc.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Mvc.Signed</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Mvc.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Mvc</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Signed</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.WebApi.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.WebApi.Signed</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title>Raygun for ASP.NET Web API</title>
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.WebApi.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.WebApi</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title>Raygun for ASP.NET Web API</title>
<authors>Raygun</authors>
<owners />
Expand Down
4 changes: 2 additions & 2 deletions Mindscape.Raygun4Net.WebApi/Properties/AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.7.0.0")]
[assembly: AssemblyFileVersion("5.7.0.0")]
[assembly: AssemblyVersion("5.8.0.0")]
[assembly: AssemblyFileVersion("5.8.0.0")]
2 changes: 2 additions & 0 deletions Mindscape.Raygun4Net.WebApi/RaygunWebApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace Mindscape.Raygun4Net.WebApi
{
public class RaygunWebApiClient : RaygunClientBase
{
internal const string UnhandledExceptionTag = "UnhandledException";

private readonly string _apiKey;
protected readonly RaygunRequestMessageOptions _requestMessageOptions = new RaygunRequestMessageOptions();
private readonly List<Type> _wrapperExceptions = new List<Type>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Dispatcher;
Expand All @@ -25,13 +26,13 @@ public IHttpController Create(HttpRequestMessage request, HttpControllerDescript
catch(InvalidOperationException ex)
{
var client = _clientCreator.GenerateRaygunWebApiClient(request);
client.SendInBackground(ex.InnerException);
client.SendInBackground(ex.InnerException, new List<string> {RaygunWebApiClient.UnhandledExceptionTag});
client.FlagExceptionAsSent(ex); // Stops us re-sending the outer exception
throw;
}
catch(Exception ex)
{
_clientCreator.GenerateRaygunWebApiClient(request).SendInBackground(ex);
_clientCreator.GenerateRaygunWebApiClient(request).SendInBackground(ex, new List<string> { RaygunWebApiClient.UnhandledExceptionTag });
throw;
}
}
Expand Down
8 changes: 4 additions & 4 deletions Mindscape.Raygun4Net.WebApi/RaygunWebApiFilters.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Filters;
Expand All @@ -19,13 +19,13 @@ internal RaygunWebApiExceptionFilter(IRaygunWebApiClientProvider clientCreator)

public override void OnException(HttpActionExecutedContext context)
{
_clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(context.Exception);
_clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(context.Exception, new List<string> { RaygunWebApiClient.UnhandledExceptionTag });
}

#pragma warning disable 1998
public override async Task OnExceptionAsync(HttpActionExecutedContext context, CancellationToken cancellationToken)
{
_clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(context.Exception);
_clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(context.Exception, new List<string> { RaygunWebApiClient.UnhandledExceptionTag });
}
#pragma warning restore 1998
}
Expand All @@ -50,7 +50,7 @@ public override void OnActionExecuted(HttpActionExecutedContext context)
string.Format("HTTP {0} returned while handling Request {2} {1}", (int)context.Response.StatusCode, context.Request.RequestUri, context.Request.Method),
context.Response);

_clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(e);
_clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(e, new List<string> {RaygunWebApiClient.UnhandledExceptionTag});
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions Mindscape.Raygun4Net.WebApi/RaygunWebApiSelectors.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http;
using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Dispatcher;
Expand All @@ -24,7 +25,7 @@ public HttpActionDescriptor SelectAction(HttpControllerContext controllerContext
}
catch (HttpResponseException ex)
{
_clientCreator.GenerateRaygunWebApiClient(controllerContext.Request).SendInBackground(ex);
_clientCreator.GenerateRaygunWebApiClient(controllerContext.Request).SendInBackground(ex, new List<string> { RaygunWebApiClient.UnhandledExceptionTag });
throw;
}
}
Expand Down Expand Up @@ -59,7 +60,7 @@ public HttpControllerDescriptor SelectController(HttpRequestMessage request)
}
catch (HttpResponseException ex)
{
_clientCreator.GenerateRaygunWebApiClient(request).SendInBackground(ex);
_clientCreator.GenerateRaygunWebApiClient(request).SendInBackground(ex, new List<string> { RaygunWebApiClient.UnhandledExceptionTag });
throw;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net</id>
<version>5.7.0</version>
<version>5.8.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 2 additions & 0 deletions Mindscape.Raygun4Net/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace Mindscape.Raygun4Net
{
public class RaygunClient : RaygunClientBase
{
internal const string UnhandledExceptionTag = "UnhandledException";

private readonly string _apiKey;
private readonly RaygunRequestMessageOptions _requestMessageOptions = new RaygunRequestMessageOptions();
private readonly List<Type> _wrapperExceptions = new List<Type>();
Expand Down
5 changes: 3 additions & 2 deletions Mindscape.Raygun4Net/RaygunHttpModule.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
Expand Down Expand Up @@ -41,7 +42,7 @@ private void SendError(object sender, EventArgs e)
if (CanSend(lastError))
{
var client = GetRaygunClient(application);
client.SendInBackground(lastError);
client.SendInBackground(lastError, new List<string> {RaygunClient.UnhandledExceptionTag});
}
}

Expand All @@ -50,7 +51,7 @@ public void SendError(HttpApplication application, Exception exception)
if (CanSend(exception))
{
var client = GetRaygunClient(application);
client.SendInBackground(exception);
client.SendInBackground(exception, new List<string> { RaygunClient.UnhandledExceptionTag });
}
}

Expand Down
2 changes: 2 additions & 0 deletions Mindscape.Raygun4Net4/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace Mindscape.Raygun4Net
{
public class RaygunClient : RaygunClientBase
{
internal const string UnhandledExceptionTag = "UnhandledException";

private readonly string _apiKey;
private readonly RaygunRequestMessageOptions _requestMessageOptions = new RaygunRequestMessageOptions();
private readonly List<Type> _wrapperExceptions = new List<Type>();
Expand Down

0 comments on commit d59749c

Please sign in to comment.