Skip to content

Commit

Permalink
Correct telemetry base class - this change was breaking functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drewgillies committed Jun 24, 2024
1 parent d4afb5d commit 7e1508e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
namespace NuGetGallery.Diagnostics
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class SendErrorsToTelemetryAttribute : Attribute
public sealed class SendErrorsToTelemetryAttribute :
HandleErrorAttribute
{
public void OnException(ExceptionContext context)
public override void OnException(ExceptionContext context)
{
base.OnException(context);

if (context != null)
{
try
Expand Down
4 changes: 3 additions & 1 deletion src/NuGetGallery/App_Start/AppActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.UI;
using Elmah;
using Microsoft.Extensions.DependencyInjection;
using NuGetGallery;
using NuGetGallery.Configuration;
Expand Down Expand Up @@ -252,6 +253,7 @@ private static void AppPostStart(IAppConfiguration configuration)
Routes.RegisterRoutes(RouteTable.Routes, configuration.FeedOnlyMode, configuration.AdminPanelEnabled);
AreaRegistration.RegisterAllAreas();

GlobalFilters.Filters.Add(new SendErrorsToTelemetryAttribute { View = "~/Views/Errors/InternalError.cshtml" });
GlobalFilters.Filters.Add(new ReadOnlyModeErrorFilter());
GlobalFilters.Filters.Add(new AntiForgeryErrorFilter());
GlobalFilters.Filters.Add(new UserDeletedErrorFilter());
Expand Down Expand Up @@ -293,7 +295,7 @@ private static void BackgroundJobsPostStart(IAppConfiguration configuration)
{
RestartSchedulerOnFailure = true
};
_jobManager.Fail(e => { Trace.TraceError($"{nameof(BackgroundJobsPostStart)} failure: {e.Message}"); });
_jobManager.Fail(e => ErrorLog.GetDefault(null).Log(new Error(e)));
_jobManager.Start();
}
}
Expand Down

0 comments on commit 7e1508e

Please sign in to comment.