@@ -42,7 +42,7 @@ public class InvokeFormatterCommand : PSCmdlet, IOutputWriter
4242 /// </summary>
4343 [ Parameter ( Mandatory = false , Position = 2 ) ]
4444 [ ValidateNotNull ]
45- public object Settings { get ; set ; }
45+ public object Settings { get ; set ; } = defaultSettingsPreset ;
4646
4747#if DEBUG
4848 [ Parameter ( Mandatory = false ) ]
@@ -88,18 +88,26 @@ protected override void BeginProcessing()
8888
8989 try
9090 {
91- inputSettings = PSSASettings . Create ( Settings , null , this ) ;
92- if ( inputSettings == null )
93- {
94- inputSettings = new PSSASettings (
95- defaultSettingsPreset ,
96- PSSASettings . GetSettingPresetFilePath ) ;
97- }
91+ inputSettings = PSSASettings . Create ( Settings , this . MyInvocation . PSScriptRoot , this ) ;
9892 }
99- catch
93+ catch ( Exception e )
94+ {
95+ this . ThrowTerminatingError ( new ErrorRecord (
96+ e ,
97+ "SETTNGS_ERROR" ,
98+ ErrorCategory . InvalidData ,
99+ Settings ) ) ;
100+ }
101+
102+ if ( inputSettings == null )
100103 {
101- this . WriteWarning ( String . Format ( CultureInfo . CurrentCulture , Strings . SettingsNotParsable ) ) ;
102- return ;
104+ this . ThrowTerminatingError ( new ErrorRecord (
105+ new ArgumentException ( String . Format (
106+ CultureInfo . CurrentCulture ,
107+ Strings . SettingsNotParsable ) ) ,
108+ "SETTINGS_ERROR" ,
109+ ErrorCategory . InvalidArgument ,
110+ Settings ) ) ;
103111 }
104112 }
105113
0 commit comments