File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 127127
128128
129129 # If the command is a ```[ScriptBlock]```
130- if ($Command -is [scriptblock ])
130+ if ($Command -is [scriptblock ])
131131 {
132132 # Attempt to transpile it.
133133 $TranspiledScriptBlock = $Command | .> Pipescript @ErrorsAndWarnings
142142 })
143143 return
144144 }
145+
146+ if ($TranspilerErrors ) {
147+ $failedMessage = @ (
148+ " $ ( $command.Source ) : " + " $ ( $TranspilerErrors.Count ) error(s)"
149+ if ($transpilerWarnings ) {
150+ " $ ( $TranspilerWarnings.Count ) warning(s)"
151+ }
152+ ) -join ' ,'
153+ Write-Error $failedMessage - ErrorId Build.Failed - TargetObject (
154+ [PSCustomObject ][ordered ]@ {
155+ Output = $pipescriptOutput
156+ Errors = $TranspilerErrors
157+ Warnings = $TranspilerWarnings
158+ Command = $Command
159+ Parameters = $InvokePipeScriptParameters
160+ }
161+ )
162+ }
163+
145164 # If it could not be transpiled into a [ScriptBlock] or [ScriptBlock[]]
146- if ($transpiledScriptBlock -isnot [ScriptBlock ] -and -not ($TranspiledScriptBlock -as [scriptblock []])) {
165+ if ($TranspilerErrors -or
166+ ($transpiledScriptBlock -isnot [ScriptBlock ] -and -not ($TranspiledScriptBlock -as [scriptblock []]))) {
147167 # error out.
148168 Write-Error " Command {$command } could not be transpiled into [ScriptBlock]s"
149169 return
You can’t perform that action at this time.
0 commit comments