File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -255,8 +255,23 @@ function Invoke-Program()
255
255
256
256
if ($LastExitCode -ne 0 )
257
257
{
258
- $callstack = @ (Get-PSCallStack ) -Join " `n "
259
- throw " Command execution returned $LastExitCode . Call stack:`n $callstack "
258
+ $ErrorMessage = " Error: $ ( [IO.Path ]::GetFileName($Executable )) exited with code $ ( $LastExitCode ) .`n "
259
+
260
+ $ErrorMessage += " Invocation:`n "
261
+ $ErrorMessage += " $Executable $Args `n "
262
+
263
+ $ErrorMessage += " Call stack:`n "
264
+ foreach ($Frame in @ (Get-PSCallStack )) {
265
+ $ErrorMessage += " $Frame `n "
266
+ }
267
+
268
+ $ErrorMessage += " Environment:`n "
269
+ foreach ($EnvVar in ((Get-ChildItem env:* ).GetEnumerator() | Sort-Object Key))
270
+ {
271
+ $ErrorMessage += " $ ( $EnvVar.Key ) =$ ( $EnvVar.Value ) `n "
272
+ }
273
+
274
+ throw $ErrorMessage
260
275
}
261
276
}
262
277
}
You can’t perform that action at this time.
0 commit comments