Skip to content

Commit d83127d

Browse files
committed
throw error if it cant find the job.
1 parent 23ea7b1 commit d83127d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Controllers/GenericController.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,21 @@ public dynamic GetJob(string jobId)
102102
if (!Guid.TryParse(jobId, out jobGuid))
103103
throw new ArgumentOutOfRangeException("jobId is not a valid GUID");
104104

105-
using (TextReader reader = new StreamReader(
106-
Path.Combine(WebApiConfiguration.Instance.Jobs.JobStorePath, jobId + ".json")))
105+
string jobPath = Path.Combine(WebApiConfiguration.Instance.Jobs.JobStorePath, jobId + ".json");
106+
107+
if (File.Exists(jobPath))
108+
using (TextReader reader = new StreamReader(jobPath))
109+
{
110+
dynamic d = JObject.Parse(reader.ReadToEnd());
111+
return d;
112+
}
113+
114+
return new ErrorResponse
107115
{
108-
dynamic d = JObject.Parse(reader.ReadToEnd());
109-
return d;
110-
}
116+
ActivityId = Guid.NewGuid(),
117+
LogFile = String.Empty,
118+
Message = "Cannot find record of job completion"
119+
};
111120
}
112121

113122
/// <summary>

0 commit comments

Comments
 (0)