Skip to content

Commit 7b5c81a

Browse files
author
James Brundage
committed
Export-PipeScript : Making Build Errors into ErrorRecords (Fixes #378)
1 parent 459ca79 commit 7b5c81a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Commands/Export-PipeScript.ps1

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,26 @@ function Export-Pipescript {
5050

5151
$buildFileTemplate = $buildFile.Template
5252
if ($buildFileTemplate -and $buildFile.PipeScriptType -ne 'Template') {
53-
Invoke-PipeScript $buildFileTemplate.Source
53+
try {
54+
Invoke-PipeScript $buildFileTemplate.Source
55+
} catch {
56+
$ex = $_
57+
Write-Error -ErrorRecord $ex
58+
}
5459
$alreadyBuilt[$buildFileTemplate.Source] = $true
5560
}
5661

5762
$EventsFromThisBuild = Get-Event |
5863
Where-Object TimeGenerated -gt $ThisBuildStartedAt |
59-
Where-Object SourceIdentifier -Like 'PipeScript.*'
64+
Where-Object SourceIdentifier -Like '*PipeScript*'
6065

61-
Invoke-PipeScript $buildFile.Source
66+
try {
67+
Invoke-PipeScript $buildFile.Source
68+
} catch {
69+
$ex = $_
70+
Write-Error -ErrorRecord $ex
71+
}
72+
6273
$alreadyBuilt[$buildFile.Source] = $true
6374
}
6475

0 commit comments

Comments
 (0)