summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs19
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs11
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs4
3 files changed, 24 insertions, 10 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index b4a23231e..84c6252a2 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Services.Base
using System.Text;
using HandBrake.ApplicationServices.EventArgs;
+ using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -59,7 +60,7 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </summary>
public EncodeBase()
{
- this.logBuffer = new StringBuilder();
+ this.logBuffer = new StringBuilder();
}
#region Events
@@ -363,18 +364,18 @@ namespace HandBrake.ApplicationServices.Services.Base
protected void VerifyEncodeDestinationPath(QueueTask task)
{
// Make sure the path exists, attempt to create it if it doesn't
- string path = Directory.GetParent(task.Destination).ToString();
- if (!Directory.Exists(path))
+ try
{
- try
+ string path = Directory.GetParent(task.Destination).ToString();
+ if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
- catch (Exception)
- {
- throw new Exception(
- "Unable to create directory for the encoded output. Please verify the drive and path is correct.");
- }
+ }
+ catch (Exception exc)
+ {
+ throw new GeneralApplicationException(
+ "Unable to create directory for the encoded output.", "Please verify that you have a valid path.", exc);
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
index 6cddd2707..7c60d1e86 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
@@ -322,7 +322,16 @@ namespace HandBrake.ApplicationServices.Services
{
XmlSerializer serializer = new XmlSerializer(typeof(List<QueueTask>));
- List<QueueTask> list = serializer.Deserialize(strm) as List<QueueTask>;
+ List<QueueTask> list;
+
+ try
+ {
+ list = serializer.Deserialize(strm) as List<QueueTask>;
+ }
+ catch (Exception exc)
+ {
+ throw new GeneralApplicationException("Unable to restore queue file.", "The file may be corrupted or from an older incompatible version of HandBrake", exc);
+ }
if (list != null)
foreach (QueueTask item in list)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index e9342ca4e..ce3a756ed 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -210,6 +210,10 @@ namespace HandBrake.ApplicationServices.Services
{
this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Error;
this.Pause();
+ if (e.Exception.GetType() == typeof(GeneralApplicationException))
+ {
+ throw e.Exception;
+ }
throw new GeneralApplicationException(e.ErrorInformation, e.Exception.Message, e.Exception);
}