Added stop/fail message as requested in #1914

This commit is contained in:
Kenneth Skovhede
2016-09-28 09:55:04 +02:00
parent 8126bceae8
commit 9a228336c2
2 changed files with 13 additions and 4 deletions
+11 -4
View File
@@ -89,11 +89,16 @@ namespace Duplicati.Library.Main
private void OperationRunning(bool isRunning)
{
if (m_options != null && !m_options.AllowSleep && !Duplicati.Library.Utility.Utility.IsClientLinux)
{
try
{
Win32.SetThreadExecutionState(Win32.EXECUTION_STATE.ES_CONTINUOUS | (isRunning ? Win32.EXECUTION_STATE.ES_SYSTEM_REQUIRED : 0));
}
catch { } //TODO: Report this somehow
catch (Exception ex)
{
Logging.Log.WriteMessage("Failed to set sleep prevention", Logging.LogMessageType.Warning, ex);
}
}
}
/// <summary>
@@ -352,7 +357,6 @@ namespace Duplicati.Library.Main
using(new Logging.Timer(string.Format("Running {0}", result.MainOperation)))
{
SetupCommonOptions(result, ref paths, ref filter);
OperationRunning(true);
method(result);
@@ -360,18 +364,21 @@ namespace Duplicati.Library.Main
result.SetDatabase(null);
OnOperationComplete(result);
Library.Logging.Log.WriteMessage(Strings.Controller.CompletedOperationMessage(m_options.MainAction), Logging.LogMessageType.Information);
return result;
}
}
catch (Exception ex)
{
Logging.Log.WriteMessage("Terminated with error: " + ex.Message, Duplicati.Library.Logging.LogMessageType.Error, ex);
OnOperationComplete(ex);
try { (result as BasicResults).OperationProgressUpdater.UpdatePhase(OperationPhase.Error); }
catch { }
Library.Logging.Log.WriteMessage(Strings.Controller.FailedOperationMessage(m_options.MainAction, ex.Message), Logging.LogMessageType.Error, ex);
throw;
}
finally
+2
View File
@@ -20,6 +20,8 @@ namespace Duplicati.Library.Main.Strings
public static string UnsupportedSizeValue(string optionname, string value) { return LC.L(@"The value ""{1}"" supplied to --{0} does not represent a valid size", optionname, value); }
public static string UnsupportedTimeValue(string optionname, string value) { return LC.L(@"The value ""{1}"" supplied to --{0} does not represent a valid time", optionname, value); }
public static string StartingOperationMessage(OperationMode operationname) { return LC.L(@"The operation {0} has started", operationname); }
public static string CompletedOperationMessage(OperationMode operationname) { return LC.L(@"The operation {0} has completed", operationname); }
public static string FailedOperationMessage(OperationMode operationname, string errormessage) { return LC.L(@"The operation {0} has failed with error: {1}", operationname, errormessage); }
public static string InvalidPathError(string path, string message) { return LC.L(@"Invalid path: ""{0}"" ({1})", path, message); }
public static string FailedForceLocaleError(string exMsg) { return LC.L(@"Failed to apply 'force-locale' setting. Please try to update .NET-Framework. Exception was: ""{0}"" ", exMsg); }
}