Display results from Piscal processing

Error handling for Piscal processing
This commit is contained in:
2016-03-07 11:47:55 -05:00
parent c80d048c39
commit 05b2bfefb1
11 changed files with 191 additions and 58 deletions
+15 -2
View File
@@ -16,6 +16,7 @@ namespace LeafWeb.Core.Remote
private const string StatusSuccess = "success";
private const string StatusRunning = "running";
private const string StatusNotStarted = "not started";
private const string StatusError = "error";
public PiscalSshClient(string connectionString)
@@ -62,7 +63,7 @@ namespace LeafWeb.Core.Remote
ssh.Disconnect();
if (command.ExitStatus != 0)
throw new PiscalClientException(command.Error);
throw new PiscalClientException(command.Result);
Console.Write(command.Result);
}
@@ -78,6 +79,8 @@ namespace LeafWeb.Core.Remote
return PiscalStatus.Running;
case StatusSuccess:
return PiscalStatus.Success;
case StatusNotStarted:
return PiscalStatus.NotStarted;
default:
return PiscalStatus.Error;
}
@@ -94,7 +97,7 @@ namespace LeafWeb.Core.Remote
ssh.Disconnect();
if (command.ExitStatus != 0)
throw new PiscalClientException(command.Error);
throw new PiscalClientException(command.Result);
return command.Result
.SplitNewLine()
@@ -137,6 +140,16 @@ namespace LeafWeb.Core.Remote
}
}
public string GetErrorMessage(PiscalLeafInputFile file)
{
var status = GetLeafInputStatusRaw(file);
if (status[0] != StatusError)
return string.Empty;
var errorLines = status.Skip(1).ToArray();
return errorLines.Join(Environment.NewLine);
}
public void CleanupLeafProcess(PiscalLeafInputFile file)
{
var status = GetLeafInputStatusRaw(file);