diff --git a/src/NzbDrone.Console/ConsoleApp.cs b/src/NzbDrone.Console/ConsoleApp.cs index 5a2e22448..a74146618 100644 --- a/src/NzbDrone.Console/ConsoleApp.cs +++ b/src/NzbDrone.Console/ConsoleApp.cs @@ -1,4 +1,5 @@ using System; +using System.Net.Sockets; using NLog; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Instrumentation; @@ -18,6 +19,15 @@ namespace NzbDrone.Console LogTargets.Register(startupArgs, false, true); Bootstrap.Start(startupArgs, new ConsoleAlerts()); } + catch (SocketException exception) + { + System.Console.WriteLine(""); + System.Console.WriteLine(""); + Logger.Fatal(exception.Message + ". This can happen if another instance of NzbDrone is already running or another applicaion is using the port assinged to NzbDrone (default: 8989)"); + System.Console.WriteLine("Press any key to exit..."); + System.Console.ReadLine(); + Environment.Exit(1); + } catch (Exception e) { System.Console.WriteLine(""); @@ -25,6 +35,7 @@ namespace NzbDrone.Console Logger.FatalException("EPIC FAIL!", e); System.Console.WriteLine("Press any key to exit..."); System.Console.ReadLine(); + Environment.Exit(1); } Logger.Info("Exiting main.");