Skip to content

Actionabilize errors from incorrect settings files #1263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12 changes: 7 additions & 5 deletions Engine/Commands/InvokeScriptAnalyzerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,13 @@ protected override void BeginProcessing()
? rulePaths
: rulePaths.Concat(settingsCustomRulePath).ToArray();
}
catch
catch (Exception exception)
{
this.WriteWarning(String.Format(CultureInfo.CurrentCulture, Strings.SettingsNotParsable));
stopProcessing = true;
return;
this.ThrowTerminatingError(new ErrorRecord(
exception,
"SETTINGS_ERROR",
ErrorCategory.InvalidData,
this.settings));
}

ScriptAnalyzer.Instance.Initialize(
Expand Down Expand Up @@ -357,7 +359,7 @@ protected override void ProcessRecord()
{
ProcessPath();
}

#if !PSV3
// TODO Support dependency resolution for analyzing script definitions
if (saveDscDependency)
Expand Down