diff --git a/src/NuGetGallery/App_Start/AppActivator.cs b/src/NuGetGallery/App_Start/AppActivator.cs index bf113702af..0e3d9de880 100644 --- a/src/NuGetGallery/App_Start/AppActivator.cs +++ b/src/NuGetGallery/App_Start/AppActivator.cs @@ -62,7 +62,7 @@ public static void PostStart() { if (!OwinStartup.HasRun) { - throw new NullReferenceException("The OwinStartup module did not run. Make sure the application runs in an OWIN pipeline and Microsoft.Owin.Host.SystemWeb.dll is in the bin directory."); + throw new AppActivatorException("The OwinStartup module did not run. Make sure the application runs in an OWIN pipeline and Microsoft.Owin.Host.SystemWeb.dll is in the bin directory."); } // Get configuration from the kernel diff --git a/src/NuGetGallery/NuGetGallery.csproj b/src/NuGetGallery/NuGetGallery.csproj index 840ebd2761..803fb731bf 100644 --- a/src/NuGetGallery/NuGetGallery.csproj +++ b/src/NuGetGallery/NuGetGallery.csproj @@ -1057,6 +1057,7 @@ + diff --git a/src/NuGetGallery/Services/AppActivatorException.cs b/src/NuGetGallery/Services/AppActivatorException.cs new file mode 100644 index 0000000000..ecac77eab2 --- /dev/null +++ b/src/NuGetGallery/Services/AppActivatorException.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Runtime.Serialization; + +namespace NuGetGallery +{ + /// + /// Exception thrown when application startup fails. + /// + [Serializable] + public class AppActivatorException : Exception + { + public AppActivatorException() { } + public AppActivatorException(string message) : base(message) { } + public AppActivatorException(string message, Exception inner) : base(message, inner) { } + protected AppActivatorException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { } + } +} \ No newline at end of file diff --git a/src/NuGetGallery/Services/StatisticsReportNotFoundException.cs b/src/NuGetGallery/Services/StatisticsReportNotFoundException.cs index 27e5dd799d..0d58ac3763 100644 --- a/src/NuGetGallery/Services/StatisticsReportNotFoundException.cs +++ b/src/NuGetGallery/Services/StatisticsReportNotFoundException.cs @@ -1,9 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; +using System.Runtime.Serialization; namespace NuGetGallery { @@ -17,8 +16,8 @@ public class StatisticsReportNotFoundException : Exception public StatisticsReportNotFoundException(string message) : base(message) { } public StatisticsReportNotFoundException(string message, Exception inner) : base(message, inner) { } protected StatisticsReportNotFoundException( - System.Runtime.Serialization.SerializationInfo info, - System.Runtime.Serialization.StreamingContext context) + SerializationInfo info, + StreamingContext context) : base(info, context) { } } } \ No newline at end of file