diff --git a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs index bd092c301..d2c5e3293 100644 --- a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs +++ b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs @@ -93,15 +93,15 @@ namespace NzbDrone.Common.Instrumentation if (updateClient) { dsn = RuntimeInfo.IsProduction - ? "https://40210a1318dd4182840c17230a1bef36:2432a6c304964372ac878179c6511811@sentry.io/209545" - : "https://edab7530cf9544dba1f86ac28aa0110b:b84a1425fc304f0188ef968576fe9690@sentry.io/227247"; + ? "https://f9238e093c75412b9351f80668a3a87c:a9392d355bd64cad80780a5279d9af82@sentry.io/209545" + : "https://28faaa7023384031b29e38d3be74fa11:829cdc25ebd34ad5a8c16aca920cb5b0@sentry.io/227247"; } else { dsn = RuntimeInfo.IsProduction - ? "https://40210a1318dd4182840c17230a1bef36:2432a6c304964372ac878179c6511811@sentry.io/209545" - : "https://edab7530cf9544dba1f86ac28aa0110b:b84a1425fc304f0188ef968576fe9690@sentry.io/227247"; + ? "https://f9238e093c75412b9351f80668a3a87c:a9392d355bd64cad80780a5279d9af82@sentry.io/209545" + : "https://28faaa7023384031b29e38d3be74fa11:829cdc25ebd34ad5a8c16aca920cb5b0@sentry.io/227247"; } var target = new SentryTarget(dsn) diff --git a/src/NzbDrone.Core/Configuration/AccessDeniedConfigFileException.cs b/src/NzbDrone.Core/Configuration/AccessDeniedConfigFileException.cs new file mode 100644 index 000000000..64b23a290 --- /dev/null +++ b/src/NzbDrone.Core/Configuration/AccessDeniedConfigFileException.cs @@ -0,0 +1,16 @@ +using System; +using NzbDrone.Common.Exceptions; + +namespace NzbDrone.Core.Configuration +{ + public class AccessDeniedConfigFileException : NzbDroneException + { + public AccessDeniedConfigFileException(string message) : base(message) + { + } + + public AccessDeniedConfigFileException(string message, Exception innerException) : base(message, innerException) + { + } + } +} diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs index 8c12a5334..6f316df4c 100644 --- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -340,14 +340,27 @@ namespace NzbDrone.Core.Configuration { throw new InvalidConfigFileException($"{_configFile} is corrupt is invalid. Please delete the config file and Lidarr will recreate it.", ex); } + + catch (UnauthorizedAccessException ex) + { + throw new AccessDeniedConfigFileException($"Lidarr does not have access to config file: {_configFile}. Please fix permissions", ex); + } } private void SaveConfigFile(XDocument xDoc) { - lock (Mutex) + try + { + lock (Mutex) + { + _diskProvider.WriteAllText(_configFile, xDoc.ToString()); + } + } + catch (UnauthorizedAccessException ex) { - _diskProvider.WriteAllText(_configFile, xDoc.ToString()); + throw new AccessDeniedConfigFileException($"Lidarr does not have access to config file: {_configFile}. Please fix permissions", ex); } + } private string GenerateApiKey() diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 7347bc215..8a28cddc1 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -141,6 +141,7 @@ + diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index e5b6e8413..28a9be29b 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -54,6 +54,10 @@ namespace NzbDrone.Host { throw new LidarrStartupException(ex); } + catch (AccessDeniedConfigFileException ex) + { + throw new LidarrStartupException(ex); + } catch (TerminateApplicationException ex) { Logger.Info(ex.Message);