mirror of https://github.com/Sonarr/Sonarr
Better exception handling in NzbDrone.exe
This commit is contained in:
parent
87cf08a365
commit
f1248d12c6
|
@ -1,16 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using NLog;
|
|
||||||
using Ninject;
|
using Ninject;
|
||||||
|
using NzbDrone.Providers;
|
||||||
|
|
||||||
namespace NzbDrone
|
namespace NzbDrone
|
||||||
{
|
{
|
||||||
public static class AppMain
|
public static class AppMain
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetLogger("Host.Main");
|
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -21,8 +17,7 @@ namespace NzbDrone
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
MonitoringProvider.AppDomainException(e);
|
||||||
Logger.Fatal(e.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace NzbDrone.Providers
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e));
|
AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e.ExceptionObject as Exception));
|
||||||
|
|
||||||
AppDomain.CurrentDomain.ProcessExit += ProgramExited;
|
AppDomain.CurrentDomain.ProcessExit += ProgramExited;
|
||||||
AppDomain.CurrentDomain.DomainUnload += ProgramExited;
|
AppDomain.CurrentDomain.DomainUnload += ProgramExited;
|
||||||
|
@ -102,10 +102,9 @@ namespace NzbDrone.Providers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void AppDomainException(object excepion)
|
public static void AppDomainException(Exception excepion)
|
||||||
{
|
{
|
||||||
Console.WriteLine("EPIC FAIL: {0}", excepion);
|
Console.WriteLine("EPIC FAIL: {0}", excepion);
|
||||||
Logger.Fatal("EPIC FAIL: {0}", excepion);
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#else
|
#else
|
||||||
|
@ -116,6 +115,8 @@ namespace NzbDrone.Providers
|
||||||
CurrentException = excepion as Exception
|
CurrentException = excepion as Exception
|
||||||
}.Submit();
|
}.Submit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Logger.Fatal("EPIC FAIL: {0}", excepion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue