Allow failing a Command using a specific message.

pull/3113/head
Taloth Saldono 10 years ago
parent a058333f65
commit 8833f1ad31

@ -60,21 +60,21 @@ namespace NzbDrone.Core.Messaging.Commands
SetMessage("Starting");
}
public void Failed(Exception exception)
public void Failed(Exception exception, string message = "Failed")
{
_stopWatch.Stop();
StateChangeTime = DateTime.UtcNow;
State = CommandStatus.Failed;
Exception = exception;
SetMessage("Failed");
SetMessage(message);
}
public void Completed()
public void Completed(string message = "Completed")
{
_stopWatch.Stop();
StateChangeTime = DateTime.UtcNow;
State = CommandStatus.Completed;
SetMessage("Completed");
SetMessage(message);
}
public void SetMessage(string message)

@ -129,8 +129,12 @@ namespace NzbDrone.Core.Messaging.Commands
}
handler.Execute((TCommand)command);
if (command.State == CommandStatus.Running)
{
_trackCommands.Completed(command);
}
}
catch (Exception e)
{
_trackCommands.Failed(command, e);

Loading…
Cancel
Save