mirror of https://github.com/lidarr/Lidarr
Allow failing a Command using a specific message.
This commit is contained in:
parent
a058333f65
commit
8833f1ad31
|
@ -60,21 +60,21 @@ namespace NzbDrone.Core.Messaging.Commands
|
||||||
SetMessage("Starting");
|
SetMessage("Starting");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Failed(Exception exception)
|
public void Failed(Exception exception, string message = "Failed")
|
||||||
{
|
{
|
||||||
_stopWatch.Stop();
|
_stopWatch.Stop();
|
||||||
StateChangeTime = DateTime.UtcNow;
|
StateChangeTime = DateTime.UtcNow;
|
||||||
State = CommandStatus.Failed;
|
State = CommandStatus.Failed;
|
||||||
Exception = exception;
|
Exception = exception;
|
||||||
SetMessage("Failed");
|
SetMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Completed()
|
public void Completed(string message = "Completed")
|
||||||
{
|
{
|
||||||
_stopWatch.Stop();
|
_stopWatch.Stop();
|
||||||
StateChangeTime = DateTime.UtcNow;
|
StateChangeTime = DateTime.UtcNow;
|
||||||
State = CommandStatus.Completed;
|
State = CommandStatus.Completed;
|
||||||
SetMessage("Completed");
|
SetMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMessage(string message)
|
public void SetMessage(string message)
|
||||||
|
|
|
@ -129,7 +129,11 @@ namespace NzbDrone.Core.Messaging.Commands
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.Execute((TCommand)command);
|
handler.Execute((TCommand)command);
|
||||||
_trackCommands.Completed(command);
|
|
||||||
|
if (command.State == CommandStatus.Running)
|
||||||
|
{
|
||||||
|
_trackCommands.Completed(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue