From 2246dfab052638fd43e6807f44dd8ae44aa7fe52 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 27 Jun 2017 22:50:18 -0700 Subject: [PATCH] Fixed: Logging error when accessing mount point Fixes #1993 --- src/NzbDrone.Mono/Disk/DiskProvider.cs | 34 ++++++-------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/src/NzbDrone.Mono/Disk/DiskProvider.cs b/src/NzbDrone.Mono/Disk/DiskProvider.cs index 27bdaf60c..db1e125b5 100644 --- a/src/NzbDrone.Mono/Disk/DiskProvider.cs +++ b/src/NzbDrone.Mono/Disk/DiskProvider.cs @@ -40,24 +40,15 @@ namespace NzbDrone.Mono.Disk { Ensure.That(path, () => path).IsValidPath(); - try - { - var mount = GetMount(path); + var mount = GetMount(path); - if (mount == null) - { - Logger.Debug("Unable to get free space for '{0}', unable to find suitable drive", path); - return null; - } - - return mount.AvailableFreeSpace; - } - catch (InvalidOperationException ex) + if (mount == null) { - Logger.Error(ex, "Couldn't get free space for {0}", path); + Logger.Debug("Unable to get free space for '{0}', unable to find suitable drive", path); + return null; } - return null; + return mount.AvailableFreeSpace; } public override void InheritFolderPermissions(string filename) @@ -100,20 +91,9 @@ namespace NzbDrone.Mono.Disk { Ensure.That(path, () => path).IsValidPath(); - try - { - var mount = GetMount(path); + var mount = GetMount(path); - if (mount == null) return null; - - return mount.TotalSize; - } - catch (InvalidOperationException e) - { - Logger.Error(e, "Couldn't get total space for {0}", path); - } - - return null; + return mount?.TotalSize; } public override bool TryCreateHardLink(string source, string destination)