Corrected exception logging.

This commit is contained in:
Mark McDowall 2012-01-16 23:53:42 -08:00
parent 1301dc1b7b
commit 106f073cf2
1 changed files with 24 additions and 24 deletions

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Common
if (IsNzbDronePortOpen())
{
Logger.Trace("NzbDrone port is already open, skippings");
Logger.Trace("NzbDrone port is already open, skipping.");
return;
}
@ -70,23 +70,19 @@ namespace NzbDrone.Common
{
var currentIdentity = WindowsIdentity.GetCurrent();
if (currentIdentity == null)
{
Logger.Trace("Could not obtain the current user.");
return false;
}
var principal = new WindowsPrincipal(currentIdentity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
catch(Exception ex)
{
Logger.TraceException("Error checking is current user is an administrator.", ex);
Logger.WarnException("Error checking if the current user is an administrator.", ex);
return false;
}
}
public virtual bool IsNzbDronePortOpen()
{
try
{
var netFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", false);
var mgr = (INetFwMgr)Activator.CreateInstance(netFwMgrType);
@ -101,7 +97,11 @@ namespace NzbDrone.Common
if (p.Port == _configFileProvider.Port)
return true;
}
}
catch(Exception ex)
{
Logger.WarnException("Failed to check for open port in firewall", ex);
}
return false;
}
@ -126,7 +126,7 @@ namespace NzbDrone.Common
}
catch(Exception ex)
{
Logger.Trace("Failed to open port in firewall for NzbDrone" + portNumber, ex);
Logger.WarnException("Failed to open port in firewall for NzbDrone" + portNumber, ex);
return false;
}
}
@ -158,7 +158,7 @@ namespace NzbDrone.Common
}
catch(Exception ex)
{
Logger.Trace("Failed to close port in firewall for NzbDrone", ex);
Logger.WarnException("Failed to close port in firewall for NzbDrone", ex);
}
return 0;
@ -181,7 +181,7 @@ namespace NzbDrone.Common
catch(Exception ex)
{
Logger.Trace("Error registering URL", ex);
Logger.WarnException("Error registering URL", ex);
}
return false;
@ -204,7 +204,7 @@ namespace NzbDrone.Common
catch (Exception ex)
{
Logger.Trace("Error registering URL", ex);
Logger.WarnException("Error registering URL", ex);
}
return false;