diff options
-rw-r--r-- | Duplicati/Library/AutoUpdater/UpdaterManager.cs | 19 | ||||
-rw-r--r-- | Duplicati/Library/DynamicLoader/BackendLoader.cs | 8 |
2 files changed, 18 insertions, 9 deletions
diff --git a/Duplicati/Library/AutoUpdater/UpdaterManager.cs b/Duplicati/Library/AutoUpdater/UpdaterManager.cs index 89e4b596d..813056294 100644 --- a/Duplicati/Library/AutoUpdater/UpdaterManager.cs +++ b/Duplicati/Library/AutoUpdater/UpdaterManager.cs @@ -18,12 +18,13 @@ using System;
using System.Linq;
using System.Collections.Generic;
-using System.IO; +using System.IO;
+using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using Duplicati.Library.Interface;
-using Duplicati.Library.Common.IO; -using Duplicati.Library.Common; - +using Duplicati.Library.Common.IO;
+using Duplicati.Library.Common;
+
namespace Duplicati.Library.AutoUpdater
{
public enum AutoUpdateStrategy
@@ -1025,9 +1026,13 @@ namespace Duplicati.Library.AutoUpdater }
if (tex.InnerException != null)
- throw tex.InnerException;
- else
- throw;
+ {
+ // Unwrap exceptions for nicer display. The ExceptionDispatchInfo class allows us to
+ // rethrow an exception without changing the stack trace.
+ ExceptionDispatchInfo.Capture(tex.InnerException).Throw();
+ }
+
+ throw;
}
}
diff --git a/Duplicati/Library/DynamicLoader/BackendLoader.cs b/Duplicati/Library/DynamicLoader/BackendLoader.cs index 88ed5e0e6..e563d6f78 100644 --- a/Duplicati/Library/DynamicLoader/BackendLoader.cs +++ b/Duplicati/Library/DynamicLoader/BackendLoader.cs @@ -24,6 +24,7 @@ using Duplicati.Library.Interface; using System.Collections.Specialized;
using System.Web;
using System.Linq;
+using System.Runtime.ExceptionServices;
namespace Duplicati.Library.DynamicLoader
{
@@ -96,9 +97,12 @@ namespace Duplicati.Library.DynamicLoader }
catch (System.Reflection.TargetInvocationException tex)
{
- // Unwrap exceptions for nicer display
if (tex.InnerException != null)
- throw new Exception("Unwrapped TargetInvocationException", tex.InnerException);
+ {
+ // Unwrap exceptions for nicer display. The ExceptionDispatchInfo class allows us to
+ // rethrow an exception without changing the stack trace.
+ ExceptionDispatchInfo.Capture(tex.InnerException).Throw();
+ }
throw;
}
|