diff --git a/src/NzbDrone.Common/Disk/DestinationAlreadyExistsException.cs b/src/NzbDrone.Common/Disk/DestinationAlreadyExistsException.cs
new file mode 100644
index 0000000000..9864137427
--- /dev/null
+++ b/src/NzbDrone.Common/Disk/DestinationAlreadyExistsException.cs
@@ -0,0 +1,29 @@
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace NzbDrone.Common.Disk
+{
+ public class DestinationAlreadyExistsException : IOException
+ {
+ public DestinationAlreadyExistsException()
+ {
+ }
+
+ public DestinationAlreadyExistsException(string message) : base(message)
+ {
+ }
+
+ public DestinationAlreadyExistsException(string message, int hresult) : base(message, hresult)
+ {
+ }
+
+ public DestinationAlreadyExistsException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+
+ protected DestinationAlreadyExistsException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/NzbDrone.Common/Disk/DiskTransferService.cs b/src/NzbDrone.Common/Disk/DiskTransferService.cs
index 7bfe67ed17..3dedc38d0f 100644
--- a/src/NzbDrone.Common/Disk/DiskTransferService.cs
+++ b/src/NzbDrone.Common/Disk/DiskTransferService.cs
@@ -1,10 +1,11 @@
-using System;
+using System;
using System.IO;
using System.Linq;
using System.Threading;
using NLog;
using NzbDrone.Common.EnsureThat;
using NzbDrone.Common.EnvironmentInfo;
+using NzbDrone.Common.Exceptions;
using NzbDrone.Common.Extensions;
namespace NzbDrone.Common.Disk
@@ -340,7 +341,7 @@ private void ClearTargetPath(string sourcePath, string targetPath, bool overwrit
}
else
{
- throw new IOException(string.Format("Destination already exists. [{0}] to [{1}]", sourcePath, targetPath));
+ throw new DestinationAlreadyExistsException($"Destination {targetPath} already exists.");
}
}
}
diff --git a/src/NzbDrone.Common/NzbDrone.Common.csproj b/src/NzbDrone.Common/NzbDrone.Common.csproj
index a2516ea68c..83ec8fb241 100644
--- a/src/NzbDrone.Common/NzbDrone.Common.csproj
+++ b/src/NzbDrone.Common/NzbDrone.Common.csproj
@@ -92,6 +92,7 @@
+
diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs
index f2a0b9be6d..648becce65 100644
--- a/src/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs
+++ b/src/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -12,6 +12,7 @@
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv;
+using NzbDrone.Common;
namespace NzbDrone.Core.MediaFiles
{
@@ -157,7 +158,7 @@ private void EnsureEpisodeFolder(EpisodeFile episodeFile, Series series, int sea
if (!_diskProvider.FolderExists(rootFolder))
{
- throw new DirectoryNotFoundException(string.Format("Root folder '{0}' was not found.", rootFolder));
+ throw new EpisodeImport.RootFolderNotFoundException(string.Format("Root folder '{0}' was not found.", rootFolder));
}
var changed = false;
diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs
index 4694803e32..71ad64609a 100644
--- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs
+++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -12,7 +12,7 @@
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Download;
using NzbDrone.Core.Extras;
-
+using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.MediaFiles.EpisodeImport
{
@@ -122,6 +122,16 @@ public List Import(List decisions, bool newDownloa
_eventAggregator.PublishEvent(new EpisodeImportedEvent(localEpisode, episodeFile, oldFiles, newDownload, downloadClientItem));
}
+ catch (RootFolderNotFoundException e)
+ {
+ _logger.Warn(e, "Couldn't import episode " + localEpisode);
+ importResults.Add(new ImportResult(importDecision, "Failed to import episode, Root folder missing."));
+ }
+ catch (DestinationAlreadyExistsException e)
+ {
+ _logger.Warn(e, "Couldn't import episode " + localEpisode);
+ importResults.Add(new ImportResult(importDecision, "Failed to import episode, Destination already exists."));
+ }
catch (Exception e)
{
_logger.Warn(e, "Couldn't import episode " + localEpisode);
diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/RootFolderNotFoundException.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/RootFolderNotFoundException.cs
new file mode 100644
index 0000000000..afa918a77b
--- /dev/null
+++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/RootFolderNotFoundException.cs
@@ -0,0 +1,25 @@
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace NzbDrone.Core.MediaFiles.EpisodeImport
+{
+ public class RootFolderNotFoundException : DirectoryNotFoundException
+ {
+ public RootFolderNotFoundException()
+ {
+ }
+
+ public RootFolderNotFoundException(string message) : base(message)
+ {
+ }
+
+ public RootFolderNotFoundException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+
+ protected RootFolderNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj
index f565a36bf0..f9478e284f 100644
--- a/src/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/src/NzbDrone.Core/NzbDrone.Core.csproj
@@ -782,6 +782,7 @@
+