@@ -42,7 +42,7 @@ public class InvokeFormatterCommand : PSCmdlet, IOutputWriter
42
42
/// </summary>
43
43
[ Parameter ( Mandatory = false , Position = 2 ) ]
44
44
[ ValidateNotNull ]
45
- public object Settings { get ; set ; }
45
+ public object Settings { get ; set ; } = defaultSettingsPreset ;
46
46
47
47
#if DEBUG
48
48
[ Parameter ( Mandatory = false ) ]
@@ -88,18 +88,26 @@ protected override void BeginProcessing()
88
88
89
89
try
90
90
{
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 ) ;
98
92
}
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 )
100
103
{
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 ) ) ;
103
111
}
104
112
}
105
113
0 commit comments