File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ try {
135135 $outputCollection = $ps.EndInvoke ($asyncResult )
136136 write-traces
137137
138+ if ($ps.HadErrors ) {
139+ # If there are any errors, we will exit with an error code
140+ Write-DscTrace - Now - Level Error - Message ' Errors occurred during script execution.'
141+ exit 1
142+ }
143+
138144 foreach ($output in $outputCollection ) {
139145 $outputObjects.Add ($output )
140146 }
@@ -147,12 +153,6 @@ finally {
147153 $ps.Dispose ()
148154}
149155
150- if ($ps.HadErrors ) {
151- # If there are any errors, we will exit with an error code
152- Write-DscTrace - Now - Level Error - Message ' Errors occurred during script execution.'
153- exit 1
154- }
155-
156156# Test should return a single boolean value indicating if in the desired state
157157if ($Operation -eq ' Test' ) {
158158 if ($outputObjects.Count -eq 1 -and $outputObjects [0 ] -is [bool ]) {
You can’t perform that action at this time.
0 commit comments