Skip to content

Commit

Permalink
Improve Debugging Messages for Empty Tokens (#609)
Browse files Browse the repository at this point in the history
* Improve Debugging Messages for Empty Tokens

* fix tests
  • Loading branch information
ethanchewy authored and TingluoHuang committed Apr 21, 2021
1 parent c7a500a commit 93531ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Runner.Worker/ActionManifestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public ActionDefinitionData Load(IExecutionContext executionContext, string mani
// Evaluate Runs Last
if (actionRunValueToken != null)
{
actionDefinition.Execution = ConvertRuns(executionContext, templateContext, actionRunValueToken, actionOutputs);
actionDefinition.Execution = ConvertRuns(executionContext, templateContext, actionRunValueToken, fileRelativePath, actionOutputs);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -359,6 +359,7 @@ private ActionExecutionData ConvertRuns(
IExecutionContext executionContext,
TemplateContext templateContext,
TemplateToken inputsToken,
String fileRelativePath,
MappingToken outputs = null)
{
var runsMapping = inputsToken.AssertMapping("runs");
Expand Down Expand Up @@ -442,7 +443,7 @@ private ActionExecutionData ConvertRuns(
{
if (string.IsNullOrEmpty(imageToken?.Value))
{
throw new ArgumentNullException($"Image is not provided.");
throw new ArgumentNullException($"You are using a Container Action but an image is not provided in {fileRelativePath}.");
}
else
{
Expand All @@ -463,7 +464,7 @@ private ActionExecutionData ConvertRuns(
{
if (string.IsNullOrEmpty(mainToken?.Value))
{
throw new ArgumentNullException($"Entry javascript file is not provided.");
throw new ArgumentNullException($"You are using a JavaScript Action but there is not an entry JavaScript file provided in {fileRelativePath}.");
}
else
{
Expand All @@ -481,8 +482,7 @@ private ActionExecutionData ConvertRuns(
{
if (steps == null)
{
// TODO: Add a more helpful error message + including file name, etc. to show user that it's because of their yaml file
throw new ArgumentNullException($"No steps provided.");
throw new ArgumentNullException($"You are using a composite action but there are no steps provided in {fileRelativePath}.");
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/Test/L0/Worker/ActionManagerL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ public async void PrepareActions_RepositoryActionWithInvalidWrapperActionfile_No
{
var traceFile = Path.GetTempFileName();
File.Copy(_hc.TraceFileName, traceFile, true);
Assert.Contains("Entry javascript file is not provided.", File.ReadAllText(traceFile));
Assert.Contains("You are using a JavaScript Action but there is not an entry JavaScript file provided in", File.ReadAllText(traceFile));
}
}
finally
Expand Down Expand Up @@ -2466,7 +2466,7 @@ public async void PrepareActions_RepositoryActionWithInvalidWrapperActionfile_No
{
var traceFile = Path.GetTempFileName();
File.Copy(_hc.TraceFileName, traceFile, true);
Assert.Contains("Entry javascript file is not provided.", File.ReadAllText(traceFile));
Assert.Contains("You are using a JavaScript Action but there is not an entry JavaScript file provided in", File.ReadAllText(traceFile));
}
}
finally
Expand Down

0 comments on commit 93531ff

Please sign in to comment.