From a6153c3cd8155a6d69a7a51e042145569ac5da2b Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 31 Dec 2018 14:52:11 -0800 Subject: [PATCH 1/2] Do not explicitly rethrow exception. When rethrowing an exception, we should do it by simply calling throw; and not throw exc;, because the stack trace is reset with the second syntax, making debugging a lot harder. --- Duplicati/CommandLine/BackendTester/Program.cs | 2 +- Duplicati/Server/Program.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Duplicati/CommandLine/BackendTester/Program.cs b/Duplicati/CommandLine/BackendTester/Program.cs index afdf09dc2..33d726557 100644 --- a/Duplicati/CommandLine/BackendTester/Program.cs +++ b/Duplicati/CommandLine/BackendTester/Program.cs @@ -194,7 +194,7 @@ namespace Duplicati.CommandLine.BackendTester } if (curlist == null) - throw fex; + throw; } foreach (Library.Interface.IFileEntry fe in curlist) diff --git a/Duplicati/Server/Program.cs b/Duplicati/Server/Program.cs index 97a812d76..d6f935da6 100644 --- a/Duplicati/Server/Program.cs +++ b/Duplicati/Server/Program.cs @@ -447,8 +447,8 @@ namespace Duplicati.Server Console.WriteLine(Strings.Program.SeriousError(mex.ToString())); return 100; } - else - throw mex; + + throw; } catch (Exception ex) { From 036a0ee8b0b403763f5d560fe715266f65f1df39 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 31 Dec 2018 19:31:03 -0800 Subject: [PATCH 2/2] Remove unused variable. --- Duplicati/CommandLine/BackendTester/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Duplicati/CommandLine/BackendTester/Program.cs b/Duplicati/CommandLine/BackendTester/Program.cs index 33d726557..1b997863e 100644 --- a/Duplicati/CommandLine/BackendTester/Program.cs +++ b/Duplicati/CommandLine/BackendTester/Program.cs @@ -178,7 +178,7 @@ namespace Duplicati.CommandLine.BackendTester backend.Test(); curlist = backend.List(); } - catch (FolderMissingException fex) + catch (FolderMissingException) { if (autoCreateFolders) {