Skip to content

Commit

Permalink
Validation errors are now raised as exceptions so return a non-zero e…
Browse files Browse the repository at this point in the history
…rror code.
  • Loading branch information
Rob Pearson committed Feb 1, 2016
1 parent 497e7f8 commit e68011d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions source/OctopusTools/Importers/ProjectImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ protected override bool Validate(Dictionary<string, string> paramDictionary)

if (validatedImportSettings.HasErrors)
{
Log.Error("The following issues were found with the provided import file:");
foreach (var error in validatedImportSettings.ErrorList)
{
Log.ErrorFormat(" {0}", error);
}
var errorMessagesCsvString = string.Join(Environment.NewLine, validatedImportSettings.ErrorList);
var errorMessage = string.Format($"The following issues were found with the provided import file: {Environment.NewLine}{errorMessagesCsvString}");
throw new CommandException(errorMessage);
}
else
{
Expand Down

2 comments on commit e68011d

@robpearson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelnoonan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. All of the same information is retained, but the caller has a guarantee of a non-zero exit code upon failure. 👍

Please sign in to comment.