Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not go through try/catch cycle for "Logging" config value #166

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/Core/Configuration/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Configuration : IConfiguration
private const string DefRedirectsXmlFile = "~/CustomRedirects.config";
private const string DefNotfoundPage = "~/bvn/filenotfound/notfound.aspx";
private const LoggerMode DefLogging = LoggerMode.On;
private static LoggerMode _logging = DefLogging;
private const int DefBufferSize = 30;
private const int DefThreshhold = 5;
private const string KeyErrorFallback = "EPfBVN404UseStdErrorHandlerAsFallback";
Expand Down Expand Up @@ -107,18 +106,7 @@ public LoggerMode Logging
{
get
{
var mode = Bvn404HandlerConfiguration.Instance.Logging ?? DefLogging.ToString();

try
{
_logging = (LoggerMode)Enum.Parse(typeof(LoggerMode), mode, true /* Ignores case */);
}
catch
{
_logging = DefLogging;
}

return _logging;
return Enum.TryParse<LoggerMode>(Bvn404HandlerConfiguration.Instance.Logging, true, out var result) ? result : DefLogging;
}
}

Expand Down